$(document).ready(function(){
    var t_id = $("#T_id").val();//本贴主贴ID
    var U_Id = $("#U_Id").val();//登录用户名
    /**##################以下为支持######################
     * 设置提示,图片没有边框
     * 将现有支持链接替换为已支持文件,更新支持人数
     */
    $("a[name='z']").click(function(){
        var id = this.id;
        $(this).replaceWith("已支持");
        var thisId;//得到操作需要操作贴子ID
        var type = 'T';//默认为主贴更新操作 二种类型T:主贴支持 R:回复支持
        if (id != '') {
            //如果链接ID不为空,则为回复贴子更新操作
            type = 'R';
            thisId = id;
        } else 
            thisId = t_id;
        if (U_Id != "") {
            $.post('ViewAction.asp', {
                action: 'yes',
                type: type,
                id: thisId,
                U_Id: U_Id
            }, function(data){
                if (type == 'T') 
                    $(".z2-" + t_id).text(data);
                else 
                    $(".zR2-" + id).text(data);
            });
        }
    });
    /**##################以上为支持######################*/
    /**##################以下为反对######################
     * 设置提示,图片没有边框
     * 将现有支持链接替换为已反对文件,更新反对人数
     */
    $("a[name='f']").click(function(){
        var id = this.id;
        $(this).replaceWith("已反对");
        var thisId;//得到操作需要操作贴子ID
        var type = 'T';//默认为主贴更新操作 二种类型T:主贴支持 R:回复支持
        if (id != '') {
            //如果链接ID不为空,则为回复贴子更新操作
            type = 'R';
            thisId = id;
        } else 
            thisId = t_id;
        if (U_Id != "") {
            $.post('ViewAction.asp', {
                action: 'no',
                type: type,
                id: thisId,
                U_Id: U_Id
            }, function(data){
                if (type == 'T') 
                    $(".f2-" + t_id).text(data);
                else 
                    $(".fR2-" + id).text(data);
            });
        }
    });
    /**##################以上为反对######################*/
    /**##################以下为其他######################*/
	var Tie_id;//定义贴子ID;
	var Tie_type;//定义贴子类型;
	var Tie_floor;//贴子楼层,仅有回复拥有;
    $(".otherAction").click(function(){
		
		/**清空历史数据*/
		$("#M_Content").val("");//发送消息为空
		$("#F_content").val("");//投诉为空
		$("#send_msg_restr").remove();//返回发送信息为空
		$("#send_fmsg_restr").remove();//返回投诉信息为空
		Tie_id = this.id;//得到贴子ID
		Tie_type = this.name//得到帖子类型 T:主贴,R回复贴
        /**###############以下为设置DIV的显示与隐藏##############*/
        $("#clickeye").hide();//隐藏已经显示的DIV层
        $("#clickeye").fadeIn(200);//调出最新的DIV层
        //以下二行控制在初始加载时,显示为正在加载内容信息
        $(".smain>*").css("display", "none");
        $(".smain>.sloading").css("display", "block");
        var view_height = $("#clickeye").height();//得到IDV高
        var displayHeight = document.body.clientHeight;//可用区域高
        var div_left = $(this).offset().left - 150;//点左边距
        var div_top = $(this).offset().top; //点上边距
        var scroll_top = document.body.scrollTop;//被卷进去的高
        var use_top = div_top - scroll_top;//距上方可用区域,
        //在下方展示区域位置不够,而在上方的区域可以展示的时候,则在上方展示
        if ((displayHeight - use_top) < (view_height - 50) && use_top > view_height - 50) {
            $(".topDiv").css("top", 188);//设置指示标签
            $(".topDiv").css("background", "transparent url(/img/aaa.png) no-repeat scroll 0% 0%");
            $("#clickeye").css("left", div_left);
            $("#clickeye").css("top", div_top - view_height);
        } else {
            $(".topDiv").css("top", -2);//设置指示标签
            $(".topDiv").css("background", "transparent url(/img/tl.png) no-repeat scroll 0% 0%");
            $("#clickeye").css("left", div_left);
            $("#clickeye").css("top", div_top + $(this).height());
        }
        /**###############以上为设置DIV的显示与隐藏##############*/
        var id = this.id;//得到操作贴子ID
        var type = this.name;//得到贴子类型 T:主贴 R:回复
        /**###############以下为设置DIV的显示内容##############*/
        $.post('ViewAction.asp', {
            action: 'getUserInfo',
            type: type,
            id: id
        }, function(data){
            var userInfo = data.split(">,<");
            var i = 0;
            $(".V_USERNAme").html(userInfo[i]);
            i++;
            $(".V_MP").html(userInfo[i]);
            i++;
            $(".V_TRANK").html(userInfo[i]);
            i++;
            $(".V_SEX").html(userInfo[i]);
            i++;
            $(".V_Birthday").html(userInfo[i]);
            i++;
            $(".V_QQ").html(userInfo[i]);
            i++;
            $(".V_Email").html(userInfo[i]);
            i++;
            $(".V_SING").html(userInfo[i]);
            i++;
            $(".V_BLANKLIST").html(userInfo[i]);
            i++;
            $(".V_ONLINE").html(userInfo[i]);
            i++;
            $(".V_DATATIME").html(userInfo[i]);
            i++;
            //以下二行控制在初始加载时,将加载内容信息去掉.换成用户内容信息
            $(".smain>*").css("display", "block");
            $(".smain>.sloading").css("display", "none");
            if (userInfo[i] == "true") {
                $("#smain02>*").css("display", "none");
                $("#smain02>.tit").css("display", "block");
                $("#smain02 .V_USERNAme").html("匿名用户,不可操作");
            }
        });
        /**###############以上为设置DIV的显示内容##############*/
    });
    /**鼠标滑过图层显示不同的图层*/
    $(".slab").mouseover(function(){
        $(".slab").find(".slablo").attr("class", "slabl");
        $(".slab").find(".slabco").attr("class", "slabc");
        $(".slab").find(".slabro").attr("class", "slabr");//控制所有选项卡隐藏
        $(this).find(".slabl").attr("class", "slablo");
        $(this).find(".slabc").attr("class", "slabco");
        $(this).find(".slabr").attr("class", "slabro");//鼠标滑过的为显示
        //$(".topDiv").css("left",$(this).find("div:eq(1)").attr("name")*50-50);
        $(".smain").attr("style", "display:none ;");
        $(this).find(".slabco").attr("name");
        var id = "#smain0" + $(this).find(".slabco").attr("name");
        $(id).attr("style", "display: block;");
    });
    /**单击关闭按钮,关闭显示图层*/
    $("#squit").click(function(){
        $("#clickeye").fadeOut(200);
    });
    /**##################以上为其他######################*/
	/**###############以下为发送信息##############*/
	$("#Send_Msg").click(function(){
	    var M_Receiver_user = $(".V_USERNAme").html();//收信人
	    var M_Send_user = $("#U_name").val(); //发信人
	    var M_Content = $("#M_Content").val();//发信内容
	    if (M_Receiver_user == "") {
	        alert("收信人为空!,请确定收信人!");
	        return false;
	    }
	    if (M_Send_user == "") {
	        alert("发信人为空!请确定您是否登录,是否在线!");
	        return false;
	    }
	    if (M_Content == "") {
	        alert("发送信息不可以为空!");
	        return false;
	    } else if (M_Content.length > 500) {
	        alert("发送信息不可以超过500个!");
	        return false;
	    }
		$("#smain02>*").css("display", "none");
        $("#smain02>.sloading").css("display", "block");
	    $.post('ViewAction.asp', {
	        action: 'send_msg',
			M_Receiver_user:escape(M_Receiver_user),
			M_Send_user:escape(M_Send_user),
			M_Content:escape(M_Content)
	    }, function(data){
			$("#smain02>.tit").append(data);//返回消息添加在标题之后
			$("#smain02>*").css("display", "block");
	        $("#smain02>.sloading").css("display", "none");
	    });
	});
	/**###############以上为发送信息##############*/
	/**###############以下为投诉信息##############*/
	$("#Send_feedback").click(function(){
		var F_Name = $("#U_name").val();
		var F_title = $("#T_title").val();
		var F_type = Tie_type;//反馈类型 1:投诉主题内容 2:投诉回帖内容 3:投诉包子 4:投诉管理员 5:投诉道具功能 6:投诉程序功能 10:其它
		var F_content = $("#F_content").val();
	    if (F_Name == "") {
	        alert("投诉人为空!请确定您是否登录,是否在线!");
	        return false;
	    }
	    if (F_content == "") {
	        alert("发送信息不可以为空!");
	        return false;
	    } else if (F_content.length > 500) {
	        alert("投诉信息不可以超过500个!");
	        return false;
	    }
		if(F_type=="T") {
			F_type = 1;
		} else {
			F_type = 2;
		}
		$("#smain03>*").css("display", "none");
        $("#smain03>.sloading").css("display", "block");
	    $.post('ViewAction.asp', {
	        action: 'send_feedback',
			F_TitleId:escape(Tie_id),
			F_Name:escape(F_Name),
			F_title:escape(F_title),
			F_type:escape(F_type),
			F_content:escape(F_content)
	    }, function(data){
			$("#smain03>.tit").append(data);
			$("#smain03>*").css("display", "block");
	        $("#smain03>.sloading").css("display", "none");
	    });
	});
	/**###############以上为投诉##############*/
});
/**##################以下照妖镜######################*/
function zaoyao(para){
    //以下二行控制在初始加载时,显示为正在加载内容信息
    $(".smain>*").css("display", "none");
    $(".smain>.sloading").css("display", "block");
    var id = para.id;//得到操作贴子ID
    var type = para.name;//得到贴子类型 T:主贴 R:回复
    /**###############以下为设置DIV的显示内容##############*/
    $.post('ViewAction.asp', {
        action: 'zaoyao',
        type: type,
        id: id
    }, function(data){
        var userInfo = data.split(">,<");
        var i = 0;
        $(".V_USERNAme").html(userInfo[i]);
        i++;
        $(".V_MP").html(userInfo[i]);
        i++;
        $(".V_TRANK").html(userInfo[i]);
        i++;
        $(".V_SEX").html(userInfo[i]);
        i++;
        $(".V_Birthday").html(userInfo[i]);
        i++;
        $(".V_QQ").html(userInfo[i]);
        i++;
        $(".V_Email").html(userInfo[i]);
        i++;
        $(".V_SING").html(userInfo[i]);
        i++;
        $(".V_BLANKLIST").html(userInfo[i]);
        i++;
        $(".V_ONLINE").html(userInfo[i]);
        i++;
        $(".V_DATATIME").html(userInfo[i]);
        i++;
        $(".smain>*").css("display", "block");
        $(".smain>.sloading").css("display", "none");
        if (userInfo[i] == "true") {
            $("#smain02 .V_USERNAme").html("没有此道具,不可操作");
        }
    });
}
/**###############以上为照妖镜##############*/
// JavaScript Document

