﻿var deleteCommentDiv;
function AlbumShow(albumDivId, frameId, mymeet_photo_index, is_channel) {
    var AlbumDivID = '#' + albumDivId;
    var albumFrameID = frameId;

    if ($(AlbumDivID).css('display') == 'none') {
        if (is_channel) {
            document.getElementById(albumFrameID).src = '/Control/MyMeetAlbum.aspx?mymeet_photo_index=' + mymeet_photo_index + '&id=' + albumFrameID + "&channel_photo=true";
        }
        else {
            document.getElementById(albumFrameID).src = '/Control/MyMeetAlbum.aspx?mymeet_photo_index=' + mymeet_photo_index + '&id=' + albumFrameID;
        }
    }

    if ($(AlbumDivID).css('display') != 'none') {
        $(AlbumDivID).slideUp('fast');
    }
    else {
        $(AlbumDivID).show();
    }
}
function YoutubeShow(divId, frameId, youtube_id) {
    var youtubeDivID = '#' + divId;
    var youtubeFrameID = frameId;

    if ($(youtubeDivID).css('display') == 'none') {
        document.getElementById(youtubeFrameID).src = '/Control/YoutubeView.aspx?firstPlayId=' + youtube_id + '&iframeId=' + youtubeFrameID;
    }

    if ($(youtubeDivID).css('display') != 'none') {
        $(youtubeDivID).slideUp('fast', function() {
            document.getElementById(youtubeFrameID).src = '/Control/YoutubeView.aspx?firstPlayId=' + youtube_id + '&iframeId=' + youtubeFrameID;
        });
    }
    else {
        $(youtubeDivID).show();
    }
}
function ShowMap(divID, frameID, lat, lng, zoom_level) {
    var div_id = "#" + divID;
    var frame_id = "#" + frameID;
    if ($(div_id).css('display') != 'none') {
        $(div_id).slideUp('fast');
    }
    else {
        $(div_id).show();
        $(frame_id).attr({ src: "/Control/GoogleMapView.aspx?lat=" + lat + "&lng=" + lng + "&zoom_level=" + zoom_level });
    }
}
function commentShowClick(topic_number, user_index, user_document_index) {
    var frame_id = 'iframe' + topic_number;
    var div_id = 'commentReadArea' + topic_number;

    if ($('#' + div_id).css('display') == 'none') {
        var imgId = '#commentLoad' + topic_number;
        $(imgId).show();
        document.getElementById(frame_id).src =
                    '/Control/MyMeetReply.aspx?user_document_index=' + user_document_index + '&user_index=' + user_index + '&id=' + frame_id + '&divId=' + div_id + '&is_channel=false';
    } else {
        $('#' + div_id).slideUp();
    }
}
function commentShowWithCountClick(topic_number, user_index, user_document_index, comment_index) {
    var frame_id = 'iframe' + topic_number;
    var div_id = 'commentReadArea' + topic_number;

    if ($('#' + div_id).css('display') == 'none') {
        var imgId = '#commentLoad' + topic_number;
        $(imgId).show();
        document.getElementById(frame_id).src =
                    '/Control/MyMeetReply.aspx?user_document_index=' + user_document_index + '&user_index=' + user_index + '&id=' + frame_id + '&divId=' + div_id + "&commentAddedIndex=" + comment_index;
    } else {
        $('#' + div_id).slideUp();
    }
}
function commentShowPhoto(topic_number, user_index, mymeet_photo_index) {
    var frame_id = 'iframe' + topic_number;
    var div_id = 'commentReadArea' + topic_number;

    if ($('#' + div_id).css('display') == 'none') {
        var imgId = '#commentLoad' + topic_number;
        $(imgId).show();
        document.getElementById(frame_id).src =
                    '/Control/MyMeetReply.aspx?mymeet_photo_index=' + mymeet_photo_index + '&user_index=' + user_index + '&id=' + frame_id + '&divId=' + div_id + '&is_channel=false';
    } else {
        $('#' + div_id).slideUp();
    }
}
function commentShowPhotoWithCount(topic_number, user_index, mymeet_photo_index, comment_index) {
    var frame_id = 'iframe' + topic_number;
    var div_id = 'commentReadArea' + topic_number;

    if ($('#' + div_id).css('display') == 'none') {
        var imgId = 'commentLoad' + topic_number;
        $(imgId).show();
        document.getElementById(frame_id).src =
                    '/Control/MyMeetReply.aspx?mymeet_photo_index=' + mymeet_photo_index + '&user_index=' + user_index + '&id=' + frame_id + '&divId=' + div_id + "&commentAddedIndex=" + comment_index;
    } else {
        $('#' + div_id).slideUp();
    }
}
function commentShowEventWithCountClick(topic_number, user_index, event_index, comment_index) {
    var frame_id = 'iframe' + topic_number;
    var div_id = 'commentReadArea' + topic_number;

    if ($('#' + div_id).css('display') == 'none') {
        var imgId = '#commentLoad' + topic_number;
        $(imgId).show();
        document.getElementById(frame_id).src =
                    '/Control/MyMeetReply.aspx?event_index=' + event_index + '&user_index=' + user_index + '&id=' + frame_id + '&divId=' + div_id + "&commentAddedIndex=" + comment_index;
    } else {
        $('#' + div_id).slideUp();
    }
}
function commentShowYoutube(topic_number, user_index, youtube_document_index) {
    var frame_id = 'iframe' + topic_number;
    var div_id = 'commentReadArea' + topic_number;

    if ($('#' + div_id).css('display') == 'none') {
        var imgId = '#commentLoad' + topic_number;
        $(imgId).show();
        document.getElementById(frame_id).src =
                    '/Control/MyMeetReply.aspx?youtube_document_index=' + youtube_document_index + '&user_index=' + user_index + '&id=' + frame_id + '&divId=' + div_id + '&is_channel=false';
    } else {
        $('#' + div_id).slideUp();
    }
}
function commentShowEvent(topic_number, user_index, event_index) {
    var frame_id = 'iframe' + topic_number;
    var div_id = 'commentReadArea' + topic_number;

    if ($('#' + div_id).css('display') == 'none') {
        var imgId = '#commentLoad' + topic_number;
        $(imgId).show();
        document.getElementById(frame_id).src =
                    '/Control/MyMeetReply.aspx?event_index=' + event_index + '&user_index=' + user_index + '&id=' + frame_id + '&divId=' + div_id + '&is_channel=false';
    } else {
        $('#' + div_id).slideUp();
    }
}
function commentShowYoutubeWithCount(topic_number, user_index, youtube_document_index, comment_index) {
    var frame_id = 'iframe' + topic_number;
    var div_id = 'commentReadArea' + topic_number;

    if ($('#' + div_id).css('display') == 'none') {
        var imgId = '#commentLoad' + topic_number;
        $(imgId).show();
        document.getElementById(frame_id).src =
                    '/Control/MyMeetReply.aspx?youtube_document_index=' + youtube_document_index + '&user_index=' + user_index + '&id=' + frame_id + '&divId=' + div_id + "&commentAddedIndex=" + comment_index;
    } else {
        $('#' + div_id).slideUp();
    }
}
function produceOneContent(info, user_index, content_element_number, is_group) {
    var is_content_admin = false;
    var elementDivID = "myContentElement" + content_element_number;
    var lindDivID = "lineDivID" + content_element_number;
    var content_kind_index = info.getElementsByTagName("content_kind_index")[0].firstChild.nodeValue;

    var is_map = false;

    if (info.getElementsByTagName("is_map")[0].firstChild.nodeValue == 'True') {
        is_map = true;
    }
    else {
        is_map = false;
    }    

    var element = document.createElement("div");
    element.setAttribute("id", elementDivID);
    $(element).addClass("myContentElement");
    $(element).css("margin-left", 30);
    $(element).css("margin-right", 35);

    var contentTextArea = document.createElement("div");
    $(contentTextArea).addClass("myContentTextArea");
    element.appendChild(contentTextArea);

    if (content_kind_index == "4") {
        var eventElement = document.createElement("div");
        $(eventElement).addClass("eventElement");
        element.appendChild(eventElement);

        var eventDateArea = document.createElement("div");
        $(eventDateArea).addClass("eventDateArea");
        eventElement.appendChild(eventDateArea);

        var eventDateMonth = document.createElement("div");
        $(eventDateMonth).addClass("eventDateMonth");
        $(eventDateMonth).text(info.getElementsByTagName("event_month")[0].firstChild.nodeValue);
        eventDateArea.appendChild(eventDateMonth);

        var eventDateDay = document.createElement("div");
        $(eventDateDay).addClass("eventDateDay");
        $(eventDateDay).text(info.getElementsByTagName("event_day")[0].firstChild.nodeValue);
        eventDateArea.appendChild(eventDateDay);

        var eventTextArea = document.createElement("div");
        $(eventTextArea).addClass("eventTextArea");
        eventElement.appendChild(eventTextArea);

        var eventName = document.createElement("div");
        $(eventName).addClass("eventName");
        $(eventName).text("모임제목 : ");
        eventTextArea.appendChild(eventName);

        var eventNameA = document.createElement("a");
        $(eventNameA).css("color", "#5C7D0A");
        eventNameA.innerHTML = info.getElementsByTagName("event_name")[0].firstChild.nodeValue;
        eventName.appendChild(eventNameA);

        var eventPlace = document.createElement("div");
        $(eventPlace).addClass("eventPlace");
        var place_text = "";
        if (info.getElementsByTagName("place")[0].firstChild != null) {
            place_text = info.getElementsByTagName("place")[0].firstChild.nodeValue;
        }
        $(eventPlace).text("장소 : " + place_text);
        eventTextArea.appendChild(eventPlace);

        var clear3 = document.createElement("div");
        $(clear3).addClass("clear");
        eventElement.appendChild(clear3);

        var group_nameA = document.createElement("a");
        group_nameA.setAttribute("href", "/meple/" + info.getElementsByTagName("group_address")[0].firstChild.nodeValue + "/event");
        eventElement.appendChild(group_nameA);

        var event_meple_name = document.createElement("div");
        $(event_meple_name).addClass("event_meple_name");
        $(event_meple_name).text(info.getElementsByTagName("group_name")[0].firstChild.nodeValue + "의 이벤트");
        group_nameA.appendChild(event_meple_name);

        var clear = document.createElement("div");
        $(clear).addClass("clear");
        eventElement.appendChild(clear);

        var commentWrapper = document.createElement("div");
        $(commentWrapper).addClass("commentWrapper");
        eventElement.appendChild(commentWrapper);

        var commentShow = document.createElement("div");
        $(commentShow).addClass("commentShow");
        commentWrapper.appendChild(commentShow);

        var commentATag = document.createElement("a");
        $(commentATag).css("cursor", "pointer");

        var comment_count = parseInt(info.getElementsByTagName("comment_count")[0].firstChild.nodeValue, 10);

        if (comment_count == 0) {
            commentATag.innerHTML = "댓글<span id='addedCommentClass" + content_element_number + "'>달기</span>";
        }
        else {
            commentATag.innerHTML = "댓글 <span id='addedCommentClass" + content_element_number + "'>" + comment_count + "</span>";
        }

        commentATag.setAttribute("topic_number", content_element_number);
        commentShow.appendChild(commentATag);

        var commentLoad = document.createElement("div");
        $(commentLoad).addClass("commentLoad");
        commentLoad.setAttribute("id", "commentLoad" + content_element_number);
        commentWrapper.appendChild(commentLoad);

        var loadImg = document.createElement("img");
        loadImg.setAttribute("src", "/App_Themes/Ver2/Images/ajax-loader-comment.gif");
        $(loadImg).addClass("png24");
        loadImg.setAttribute("alt", "");
        commentLoad.appendChild(loadImg);

        var clear1 = document.createElement("div");
        $(clear1).addClass("clear");
        commentWrapper.appendChild(clear1);

        commentATag.setAttribute("event_index", info.getElementsByTagName("event_index")[0].firstChild.nodeValue);
        commentATag.setAttribute("comment_index", content_element_number);

        $(commentATag).click(function() {
            var temp_event_index = $(this).attr("event_index");
            var temp_comment_index = $(this).attr("comment_index");

            commentShowEventWithCountClick(content_element_number, user_index, temp_event_index, temp_comment_index);
        });

        var eventHidden = document.createElement("div");
        eventHidden.setAttribute("id", "moreInfoDiv" + content_element_number);
        $(eventHidden).addClass("eventHidden");
        element.appendChild(eventHidden);

        var event_frame = document.createElement("iframe");
        $(event_frame).addClass("IframeClass");
        $(event_frame).css("width", "100%");
        event_frame.setAttribute("id", "mapFrame" + content_element_number);
        event_frame.setAttribute("frameBorder", "0");
        event_frame.setAttribute("scrolling", "no");
        eventHidden.appendChild(event_frame);

        eventNameA.setAttribute("div_id", $(eventHidden).attr("id"));
        eventNameA.setAttribute("frame_id", $(event_frame).attr("id"));
        eventNameA.setAttribute("event_index", info.getElementsByTagName("event_index")[0].firstChild.nodeValue);

        $(eventNameA).click(function() {
        var temp_div_id = $(this).attr("div_id");
        var temp_frame_id = $(this).attr("frame_id");
        var temp_event_index = $(this).attr("event_index");
            showMoreInfo(temp_div_id, temp_frame_id, temp_event_index);
        });

        var commentReadArea = document.createElement("div");
        commentReadArea.setAttribute("id", "commentReadArea" + content_element_number);
        $(commentReadArea).addClass("commentReadArea");
        element.appendChild(commentReadArea);

        var comment_frame = document.createElement("iframe");
        $(comment_frame).addClass("IframeClass");
        comment_frame.setAttribute("id", "iframe" + content_element_number);
        comment_frame.setAttribute("frameBorder", "0");
        comment_frame.setAttribute("scrolling", "no");
        commentReadArea.appendChild(comment_frame);

        return element;
    }

    if (user_index.toString() == info.getElementsByTagName("user_index")[0].firstChild.nodeValue) {
        is_content_admin = true;
    }

    var thumnailPicATag = document.createElement("a");
    $(thumnailPicATag).addClass("myMeetPhotoLink");
    $(thumnailPicATag).css("cursor", "pointer");
    contentTextArea.appendChild(thumnailPicATag);

    var myContentPhoto = document.createElement("div");
    $(myContentPhoto).addClass("myContentPhoto");
    thumnailPicATag.appendChild(myContentPhoto);

    var img_src;
    var img_file_name = info.getElementsByTagName("thumnail")[0].firstChild.nodeValue;

    if (content_kind_index == "1" || content_kind_index == "2" || content_kind_index == "7" || content_kind_index == "8" || content_kind_index == "9" || content_kind_index == "10" || content_kind_index == "14") {
        img_src = "/UserThumnail/" + img_file_name;
    }
    else {
        if (is_group) {
            img_file_name = info.getElementsByTagName("user_photo_path")[0].firstChild.nodeValue;
            img_src = "/UserThumnail/" + img_file_name;
        } else {
            img_src = "/GroupAboutPhoto/" + img_file_name;
        }
    }
    var thumnail = document.createElement("img");
    $(thumnail).addClass("thumnail");
    myContentPhoto.appendChild(thumnail);
    thumnail.setAttribute("src", img_src);

    var myContentPhotoIcon = document.createElement("div");
    $(myContentPhotoIcon).addClass("myContentPhotoIcon");
    contentTextArea.appendChild(myContentPhotoIcon);

    var TextContainer = document.createElement("div");
    $(TextContainer).addClass("TextContainer");
    contentTextArea.appendChild(TextContainer);

    var myContentText = document.createElement("div");
    $(myContentText).addClass("myContentText");
    TextContainer.appendChild(myContentText);

    var timeStamp = document.createElement("div");
    $(timeStamp).addClass("timeStamp");
    $(timeStamp).text(info.getElementsByTagName("regdate")[0].firstChild.nodeValue);
    TextContainer.appendChild(timeStamp);

    if (content_kind_index != '14') {
        var myContentKind = document.createElement("div");
        $(myContentKind).addClass("myContentKind");
        $(myContentKind).text("by ");
        TextContainer.appendChild(myContentKind);

        var user_link = document.createElement("a");
        user_link.setAttribute("href", "/" + info.getElementsByTagName("user_id")[0].firstChild.nodeValue);
        if (is_content_admin) {
            $(user_link).text("me");
        } else {
            $(user_link).text(info.getElementsByTagName("user_name")[0].firstChild.nodeValue);
        }
        $(user_link).css("color", "Navy");
        myContentKind.appendChild(user_link);
    }

    if (content_kind_index == "1" || content_kind_index == "2" || content_kind_index == "7" || content_kind_index == "8" || content_kind_index == "9" || content_kind_index == "10" || content_kind_index == "11" || content_kind_index == "12" || content_kind_index == "13") {
        if (is_content_admin) {
            var deleteArea = document.createElement("div");
            $(deleteArea).addClass("deleteArea");
            deleteArea.setAttribute("title", "글삭제");
            TextContainer.appendChild(deleteArea);
        }
    }

    if (is_content_admin) {
        if (content_kind_index == "1" || content_kind_index == "2" || content_kind_index == "11") {
            $(deleteArea).click(function() {
                DeleteUserDocument("#" + elementDivID, "#" + lindDivID, info.getElementsByTagName("user_document_index")[0].firstChild.nodeValue, true, false, false);
            });
        } else if (content_kind_index == "7" || content_kind_index == "8" || content_kind_index == "12") {
            $(deleteArea).click(function() {
                DeleteUserDocument("#" + elementDivID, "#" + lindDivID, info.getElementsByTagName("mymeet_photo_index")[0].firstChild.nodeValue, false, true, false);
            });

        } else if (content_kind_index == "9" || content_kind_index == "10" || content_kind_index == "13") {
            $(deleteArea).click(function() {
                DeleteUserDocument("#" + elementDivID, "#" + lindDivID, info.getElementsByTagName("youtube_document_index")[0].firstChild.nodeValue, false, false, true);
            });
        }
    }

    if (content_kind_index == "11" || content_kind_index == "12" || content_kind_index == "13") {
        if (!is_group) {
            var group_link = document.createElement("a");
            var group_address = info.getElementsByTagName("group_address")[0].firstChild.nodeValue;
            group_link.setAttribute("href", "/meple/" + group_address);
            thumnailPicATag.setAttribute("href", "/meple/" + group_address);
            var group_div = document.createElement("div");
            $(group_div).addClass("mepleName");
            var group_name = info.getElementsByTagName("group_name")[0].firstChild.nodeValue;
            $(group_div).text(group_name + "의 게시글");
            group_link.appendChild(group_div);
            TextContainer.appendChild(group_link);
        } else {
            var user_id_value = info.getElementsByTagName("user_id")[0].firstChild.nodeValue;
            thumnailPicATag.setAttribute("href", "/" + user_id_value);
        }
    } else {
        var user_id_value = info.getElementsByTagName("user_id")[0].firstChild.nodeValue;
        thumnailPicATag.setAttribute("href", "/" + user_id_value);
    }

    //        if (info.getElementsByTagName("is_comment_new")[0].firstChild.nodeValue == 'True') {
    //            var commentNew = document.createElement("div");
    //            commentNew.setAttribute("class", "commentNew");
    //            TextContainer.appendChild(commentNew);

    //            var newImg = document.createElement("img");
    //            newImg.setAttribute("src", "/App_Themes/Ver2/Images/new_notice.png");
    //            $(newImg).addClass("png24");
    //            newImg.setAttribute("alt", "");
    //            commentNew.appendChild(newImg);
    //        }       

    var div_clear = document.createElement("div");
    $(div_clear).addClass("clear");
    TextContainer.appendChild(div_clear);

    if (content_kind_index != '14') {

        var commentWrapper = document.createElement("div");
        $(commentWrapper).addClass("commentWrapper");
        TextContainer.appendChild(commentWrapper);

        var commentShow = document.createElement("div");
        $(commentShow).addClass("commentShow");
        commentWrapper.appendChild(commentShow);

        var commentATag = document.createElement("a");
        $(commentATag).css("cursor", "pointer");

        var comment_count = parseInt(info.getElementsByTagName("comment_count")[0].firstChild.nodeValue, 10);

        if (comment_count == 0) {
            commentATag.innerHTML = "댓글<span id='addedCommentClass" + content_element_number + "'>달기</span>";
        }
        else {
            commentATag.innerHTML = "댓글 <span id='addedCommentClass" + content_element_number + "'>" + comment_count + "</span>";
        }

        commentATag.setAttribute("topic_number", content_element_number);
        commentShow.appendChild(commentATag);

        var commentLoad = document.createElement("div");
        $(commentLoad).addClass("commentLoad");
        commentLoad.setAttribute("id", "commentLoad" + content_element_number);
        commentWrapper.appendChild(commentLoad);

        var loadImg = document.createElement("img");
        loadImg.setAttribute("src", "/App_Themes/Ver2/Images/ajax-loader-comment.gif");
        $(loadImg).addClass("png24");
        loadImg.setAttribute("alt", "");
        commentLoad.appendChild(loadImg);

        var document_writer_index = info.getElementsByTagName("user_index")[0].firstChild.nodeValue;
    }

    var clear2 = document.createElement("div");
    $(clear2).addClass("clear");
    contentTextArea.appendChild(clear2);

    if (content_kind_index != '14') {
        var clear1 = document.createElement("div");
        $(clear1).addClass("clear");
        commentWrapper.appendChild(clear1);
    }

    var clear = document.createElement("div");
    $(clear).addClass("clear");
    element.appendChild(clear);

    if (content_kind_index == "1" || content_kind_index == "2" || content_kind_index == "11") {
        myContentText.innerHTML = info.getElementsByTagName("user_document_content")[0].firstChild.nodeValue;

        commentATag.setAttribute("user_document_index", info.getElementsByTagName("user_document_index")[0].firstChild.nodeValue);
        commentATag.setAttribute("comment_index", content_element_number);

        if (is_map) {
            var map_link = document.createElement("a");
            myContentPhotoIcon.appendChild(map_link);

            var map_img = document.createElement("img");
            $(map_img).addClass("png24IconButtom");
            map_img.setAttribute("src", "/App_Themes/Ver2/Images/map_w24.png");
            map_link.appendChild(map_img);

            var mapArea = document.createElement("div");
            mapArea.setAttribute("id", "channel_map_area" + content_element_number);
            $(mapArea).addClass("mapArea");
            element.appendChild(mapArea);

            var map_frame = document.createElement("iframe");
            $(map_frame).addClass("mapFrame");
            map_frame.setAttribute("id", "channel_map_frame" + content_element_number);
            map_frame.setAttribute("frameBorder", "0");
            map_frame.setAttribute("scrolling", "no");
            mapArea.appendChild(map_frame);

            map_link.setAttribute("div_id", $(mapArea).attr("id"));
            map_link.setAttribute("frame_id", $(map_frame).attr("id"));
            map_link.setAttribute("lat", info.getElementsByTagName("lat")[0].firstChild.nodeValue);
            map_link.setAttribute("lng", info.getElementsByTagName("lng")[0].firstChild.nodeValue);

            $(map_link).click(function() {
                var map_div_id = $(this).attr("div_id");
                var frame_id = $(this).attr("frame_id");
                var lat = $(this).attr("lat");
                var lng = $(this).attr("lng");

                ShowMap(map_div_id, frame_id, lat, lng);
            });
        }

        $(commentATag).click(function() {
            var temp_user_document_index = $(this).attr("user_document_index");
            var temp_comment_index = $(this).attr("comment_index");

            commentShowWithCountClick(content_element_number, user_index, temp_user_document_index, temp_comment_index);
        });

    }
    else if (content_kind_index == "7" || content_kind_index == "8" || content_kind_index == "12") {
        var albumArea = document.createElement("div");
        $(albumArea).addClass("albumArea");
        albumArea.setAttribute("id", "albumArea" + content_element_number);
        element.appendChild(albumArea);

        var album_frame = document.createElement("iframe");
        album_frame.setAttribute("id", "albumFrame" + content_element_number);
        $(album_frame).addClass("IframeClass");
        album_frame.setAttribute("frameBorder", "0");
        album_frame.setAttribute("scrolling", "no");
        albumArea.appendChild(album_frame);

        var photo_link = document.createElement("a");
        myContentPhotoIcon.appendChild(photo_link);

        var photo_img = document.createElement("img");
        $(photo_img).addClass("png24IconTop");
        photo_img.setAttribute("src", "/App_Themes/Ver2/Images/photo_w24.png");
        photo_link.appendChild(photo_img);

        photo_link.setAttribute("album_number", content_element_number);
        photo_link.setAttribute("div_id", "albumArea" + content_element_number);
        photo_link.setAttribute("frame_id", "albumFrame" + content_element_number);
        photo_link.setAttribute("mymeet_photo_index", info.getElementsByTagName("mymeet_photo_index")[0].firstChild.nodeValue);

        $(photo_link).click(function() {
            var temp_album_number = $(this).attr("album_number");
            var temp_photo_index = $(this).attr("mymeet_photo_index");
            var album_div_id = $(this).attr("div_id");
            var album_frame_id = $(this).attr("frame_id");

            AlbumShow(album_div_id, album_frame_id, temp_photo_index)
        });

        if (is_map) {
            var map_link = document.createElement("a");
            myContentPhotoIcon.appendChild(map_link);

            var map_img = document.createElement("img");
            $(map_img).addClass("png24IconTop");
            map_img.setAttribute("src", "/App_Themes/Ver2/Images/map_w24.png");
            map_link.appendChild(map_img);

            var mapArea = document.createElement("div");
            mapArea.setAttribute("id", "channel_map_area" + content_element_number);
            $(mapArea).addClass("mapArea");
            element.appendChild(mapArea);

            var map_frame = document.createElement("iframe");
            $(map_frame).addClass("mapFrame");
            map_frame.setAttribute("id", "channel_map_frame" + content_element_number);
            map_frame.setAttribute("frameBorder", "0");
            map_frame.setAttribute("scrolling", "no");
            mapArea.appendChild(map_frame);

            map_link.setAttribute("div_id", $(mapArea).attr("id"));
            map_link.setAttribute("frame_id", $(map_frame).attr("id"));
            map_link.setAttribute("lat", info.getElementsByTagName("lat")[0].firstChild.nodeValue);
            map_link.setAttribute("lng", info.getElementsByTagName("lng")[0].firstChild.nodeValue);

            $(map_link).click(function() {
                var map_div_id = $(this).attr("div_id");
                var frame_id = $(this).attr("frame_id");
                var lat = $(this).attr("lat");
                var lng = $(this).attr("lng");

                ShowMap(map_div_id, frame_id, lat, lng);
            });
        }
        else {
            $(photo_img).css("padding-top", "25px");
        }


        commentATag.setAttribute("mymeet_photo_index", info.getElementsByTagName("mymeet_photo_index")[0].firstChild.nodeValue);
        commentATag.setAttribute("comment_index", content_element_number);

        $(commentATag).click(function() {
            var temp_mymeet_photo_index = $(this).attr("mymeet_photo_index");
            var temp_comment_index = $(this).attr("comment_index");

            commentShowPhotoWithCount(content_element_number, user_index, temp_mymeet_photo_index, temp_comment_index);
        });

        myContentText.innerHTML = info.getElementsByTagName("photo_description")[0].firstChild.nodeValue;
    }
    else if (content_kind_index == "9" || content_kind_index == "10" || content_kind_index == "13") {
        var youtubeArea = document.createElement("div");
        $(youtubeArea).addClass("youtubeArea");
        youtubeArea.setAttribute("id", "youtubeArea" + content_element_number)
        element.appendChild(youtubeArea);

        var youtube_frame = document.createElement("iframe");
        $(youtube_frame).addClass("IframeClass");
        youtube_frame.setAttribute("id", "youtubeFrame" + content_element_number);
        youtube_frame.setAttribute("frameBorder", "0");
        youtube_frame.setAttribute("scrolling", "no");
        youtubeArea.appendChild(youtube_frame);

        var youtube_link = document.createElement("a");
        myContentPhotoIcon.appendChild(youtube_link);

        var youtube_img = document.createElement("img");
        $(youtube_img).addClass("png24IconTop");
        youtube_img.setAttribute("src", "/App_Themes/Ver2/Images/youtube_w24.png");
        youtube_link.appendChild(youtube_img);

        youtube_link.setAttribute("youtube_id", info.getElementsByTagName("youtube_id")[0].firstChild.nodeValue);
        youtube_link.setAttribute("div_id", "youtubeArea" + content_element_number);
        youtube_link.setAttribute("frame_id", "youtubeFrame" + content_element_number);

        $(youtube_link).click(function() {
            var temp_youtube_id = $(this).attr("youtube_id");
            var youtube_div_id = $(this).attr("div_id");
            var youtube_frame_id = $(this).attr("frame_id");

            YoutubeShow(youtube_div_id, youtube_frame_id, temp_youtube_id);
        });

        if (is_map) {
            var map_link = document.createElement("a");
            myContentPhotoIcon.appendChild(map_link);

            var map_img = document.createElement("img");
            $(map_img).addClass("png24IconTop");
            map_img.setAttribute("src", "/App_Themes/Ver2/Images/map_w24.png");
            map_link.appendChild(map_img);

            var mapArea = document.createElement("div");
            mapArea.setAttribute("id", "channel_map_area" + content_element_number);
            $(mapArea).addClass("mapArea");
            element.appendChild(mapArea);

            var map_frame = document.createElement("iframe");
            $(map_frame).addClass("mapFrame");
            map_frame.setAttribute("id", "channel_map_frame" + content_element_number);
            map_frame.setAttribute("frameBorder", "0");
            map_frame.setAttribute("scrolling", "no");
            mapArea.appendChild(map_frame);

            map_link.setAttribute("div_id", $(mapArea).attr("id"));
            map_link.setAttribute("frame_id", $(map_frame).attr("id"));
            map_link.setAttribute("lat", info.getElementsByTagName("lat")[0].firstChild.nodeValue);
            map_link.setAttribute("lng", info.getElementsByTagName("lng")[0].firstChild.nodeValue);

            $(map_link).click(function() {
                var map_div_id = $(this).attr("div_id");
                var frame_id = $(this).attr("frame_id");
                var lat = $(this).attr("lat");
                var lng = $(this).attr("lng");

                ShowMap(map_div_id, frame_id, lat, lng);
            });
        }
        else {
            $(youtube_img).css("padding-top", "25px");
        }

        commentATag.setAttribute("youtube_document_index", info.getElementsByTagName("youtube_document_index")[0].firstChild.nodeValue);
        commentATag.setAttribute("comment_index", content_element_number);

        $(commentATag).click(function() {
            var temp_youtube_document_index = $(this).attr("youtube_document_index");
            var temp_comment_index = $(this).attr("comment_index");

            commentShowYoutubeWithCount(content_element_number, user_index, temp_youtube_document_index, temp_comment_index);
        });

        myContentText.innerHTML = info.getElementsByTagName("youtube_document_content")[0].firstChild.nodeValue;
    }
    else if (content_kind_index == '14') {
        if (!is_group) {
            myContentText.innerHTML = "<a style='color: #5C7D0A;' href='/" + info.getElementsByTagName("user_id")[0].firstChild.nodeValue + "'>" + info.getElementsByTagName("user_name")[0].firstChild.nodeValue + "</a>님의 미트플렉스가 시작되었습니다.";
        } else {
            myContentText.innerHTML = "<a style='color: #5C7D0A;' href='/" + info.getElementsByTagName("user_id")[0].firstChild.nodeValue + "'>" + info.getElementsByTagName("user_name")[0].firstChild.nodeValue + "</a>님이 미플의 회원이 되었습니다.";
        }
    }

    if (content_kind_index != '14') {
        var commentReadArea = document.createElement("div");
        commentReadArea.setAttribute("id", "commentReadArea" + content_element_number);
        $(commentReadArea).addClass("commentReadArea");
        element.appendChild(commentReadArea);

        var comment_frame = document.createElement("iframe");
        $(comment_frame).addClass("IframeClass");
        comment_frame.setAttribute("id", "iframe" + content_element_number);
        comment_frame.setAttribute("frameBorder", "0");
        comment_frame.setAttribute("scrolling", "no");
        commentReadArea.appendChild(comment_frame);
    }

    return element;
}
function colorToggle() {
    $('div.myContentElement').unbind("mouseover");
    $('div.myContentElement').unbind("mouseout");
    $('div.myContentElement').mouseover(function() {
        $(this).css('background-color', '#f7f7f7');
        $('div.deleteArea', this).show();
    });
    $('div.myContentElement').mouseout(function() {
        $(this).css('background-color', '#FFFFFF');
        $('div.deleteArea', this).hide();
    });
}
function produceOneContentDivLine(content_element_number) {
    var lindDivID = "lineDivID" + content_element_number;
    var elementLine = document.createElement("div");
    $(elementLine).addClass("contentBottomLine");
    elementLine.setAttribute("id", lindDivID);

    return elementLine;
}
function appendReply(comment_index, user_id, user_name, user_photo_path, regdate, content, isOwner) {
    var commentViewArea = document.createElement("div");
    $(commentViewArea).addClass("commentViewArea");

    var commentImg = document.createElement("div");
    $(commentImg).addClass("commentImg");
    commentViewArea.appendChild(commentImg);

    var commentImgBox = document.createElement("img");
    $(commentImgBox).addClass("commentImgBox");
    $(commentImgBox).attr({ src: "/UserThumnail/" + user_photo_path });
    commentImg.appendChild(commentImgBox);

    var commentInfoArea = document.createElement("div");
    $(commentInfoArea).addClass("commentInfoArea");
    commentViewArea.appendChild(commentInfoArea);

    var commentInfo = document.createElement("div");
    $(commentInfo).addClass("commentInfo");
    commentInfoArea.appendChild(commentInfo);

    var commentUserName = document.createElement("div");
    $(commentUserName).addClass("commentUserName");
    commentInfo.appendChild(commentUserName);

    var user_name_a = document.createElement("a");
    commentUserName.appendChild(user_name_a);
    user_name_a.innerHTML = user_name;
    user_name_a.setAttribute("href", "/" + user_id);
    user_name_a.setAttribute("target", "_parent");
    commentUserName.appendChild(user_name_a);

    var commentDate = document.createElement("div");
    $(commentDate).addClass("commentDate");
    $(commentDate).text(regdate);
    commentInfo.appendChild(commentDate);

    var commentDelete = document.createElement("div");
    commentDelete.setAttribute("comment_index", comment_index);
    $(commentDelete).addClass("commentDelete");
    if (!isOwner) {
        $(commentDelete).css("display", "none");
    }
    commentInfo.appendChild(commentDelete);

    $(commentDelete).click(function() {
        var temp_comment_index = $(this).attr("comment_index");
        var delUrl = "/AjaxServer/commentDeleteServer.aspx?comment_index=" + temp_comment_index;
        deleteCommentDiv = commentViewArea;
        sendRequest(commentDeleteCallback, delUrl);
        
        resizeHeight();
    });

    var clear = document.createElement("div");
    $(clear).addClass("clear");
    commentInfo.appendChild(clear);

    var commentContent = document.createElement("div");
    $(commentContent).addClass("commentContent");
    commentInfoArea.appendChild(commentContent);

    var span = document.createElement("span");
    $(span).css("font-family", "맑은 고딕");
    $(span).text(content);
    commentContent.appendChild(span);

    var clear2 = document.createElement("div");
    $(clear2).addClass("clear");
    commentViewArea.appendChild(clear2);

    var hr = document.createElement("div");
    $(hr).addClass("hr");
    commentViewArea.appendChild(hr);

    return commentViewArea;
}
function commentDeleteCallback(obj) {
    var doc = obj.responseXML;
    var list = doc.getElementsByTagName('item');

    if (list.length > 0) {
        if (list[0].getElementsByTagName('delete_flag')[0].firstChild.nodeValue == 'True') {
            $(deleteCommentDiv).remove();
            DecreaseCommentCounter();
        }
    }
}
