﻿// JavaScript Document
window.onerror = function(){return true}
$(document).ready( function() {
	$(".r2").addClass("divdisplay");
	window.onscroll=function()
	{
		var thisheight = window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;
		if(thisheight > 150)
		{
			$(".r2").fadeIn("slow"); //removeClass("divdisplay");
		}else
		{
			$(".r2").fadeOut("slow"); //addClass("divdisplay");
		}
	}
})
function closes(obj)
{
	$("#"+obj).slideUp("slow");
	$(".fulldiv").css("display","none");
}
function closeall() {
    $(".divc").slideUp("slow");
    $(".divhelp").slideUp("slow");
    $(".fulldiv").css("display", "none");
}
function divReplace(divID1,divID2)
{
	$("#"+divID1).fadeOut("slow"); 
	$("#"+divID2).fadeIn("slow");
}
$(function () {
    if ($("#my").length > 0) {
        $("#my").DMenu("#cont1");
        $("#msgt").DMenu("#cont2");
        $("#buybox").DMenu("#cont3");
    }
});
function replay_now()
{
	$("#replay_now").toggleClass("divdisplay")
}
function Givefiles()
{
	$("#filbt").html("添加文件附件 （最大10MB）");
	$("#fileContent").css("display","")
}
function Givefiles1()
{
	$("#filbt1").html("添加文件附件 （最大10MB）");
	$("#fileContent1").css("display","")
}
function ChangeWorkR(obj) {
	if(obj==1) {
	    $("#workjhmsg").css("display", "none");
	    $("#CheckJH").val("0");
	    $("#replay_now").removeClass("by-ok");
		$("#replay_now").addClass("by-new");
    }
	else {
	    $("#workjhmsg").css("display", "");
	    $("#CheckJH").val("1");
	    $("#replay_now").removeClass("by-new");
	    $("#replay_now").addClass("by-ok");
	}
}

function giveshare(obj){
	$("#share"+obj).toggleClass("sharedisplay");
}
function giveAc(obj)
{
	$("#wk"+obj).toggleClass("divdisplay");
}
//浮动窗体获得宽高等属性
jQuery.fn.floatdiv = function (location) {

    var l = 0; //居左   
    var t = 0; //居上   
    var windowWidth, windowHeight; //窗口的高和宽   
    //取得窗口的高和宽   
    if (self.innerHeight) {
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) {
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }
    l = windowWidth / 2 - $(this).width() / 2;
    t = 80; // windowHeight / 2 - $(this).height() / 2;//AL注释掉，取消高度居中
    loc = { left: l + "px", top: t + "px" };

    $(this).css("top", t);
    $(this).css("left", l);
};

//建议提交验证
function SuggestSub() {
    if ($("#SugContent").val() == "") {
        alert("请输入需求和建议内容");
        $("#SugContent").focus();
        return false;
    }
    if ($("#SugContent").val().length > 45) {
        alert("最大可输入45个字符");
        $("#SugContent").focus();
        return false;
    }
    return true;
}
function Sending(MsgID) {
    if(confirm("您确定举报该信息？")){
        $.post('/CustService.ashx/Report', { MsgID: MsgID, time: Math.random() }, function (data) {
            if (data == 1) {
                alert("举报信息已发送给管理员");
                $("#jb_" + MsgID).html("");
            }
        });
    }
}

function formMsgCheck() {
    if ($("#MsgContent").val() == "") {
        alert("请输入信息正文");
        $("#MsgContent").focus();
        return false;
    }
    if ($("#MsgContent").val().length > 500) {
        alert("信息内容过长，最大不超过500字符");
        $("#MsgContent").focus();
        return false;
    }
    return true;
}

function GiveHelp() {
    var str = $("#helpContent").html();
    if (str == "" || str == "undefined" || str == null) {
        str = "<div id=\"helpContent\" class=\"divhelp\" style=\"display:none\">";
        str += "<div class=\"hp_t\"></div>"
        str += "<div class=\"hp_close\"><a href=\"javascript:void(0)\" onclick=\"closes('helpContent')\">关闭</a>&nbsp;&nbsp;</div>";
        str += "<div class=\"hp_c\">"
        //中间内容开始
        str += "<div class=\"hp_c1\">"
        str += "<h1><center>怎样卖</center></h1>";
        str += "<p>发布一个您可以提供的工作</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>通过审核后其他人会浏览订购您的工作</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>系统通知您，他人已订购您的工作，请接受或拒绝服务</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>待您完成订购人的工作后，订购金额会增加到您的优帮网账户</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>您可以将优帮网账户金额退出到您的支付宝或财付通账户</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p><b>完成</b></p>";
        str += "</div>"

        str += "<div class=\"hp_c2\">"
        str += "<h1><center>怎样买</center></h1>";
        str += "<p>找到一个您需要的工作信息</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>通过支付宝在线支付</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>跟踪卖家的工作进度，交换文件和沟通</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>卖家提交工作后进行审核</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>卖家服务达到自己要求，审核通过，卖方账户余额增加</p>";
        str += "<div class=\"hp_down\"></div>";
        str += "<p>评价卖方的工作</p>";
        str += "</div>"
        //中间内容结束
        str += "</div>"
        str += "<div class=\"hp_Bot\"><b>请阅读我们的&nbsp;<a href=\"/home.ashx/serviceitem\">服务条款</a></b></div>"
        str += "<div class=\"hp_b\"></div>"
        str += "</div>";
        $("body").append(str);
    }
	$("body").append("<div class='fulldiv' style='display:none;' onclick='closeall()'></div>");
    $(".fulldiv").css("display", "");
    $("#helpContent").fadeIn("slow");
    $("#helpContent").floatdiv("middle");
}

function postToWb(objtit,objurl,objimg) {
    var _t = encodeURI(objtit);
    var _url = encodeURIComponent("http://www.uibang.com/Info.ashx/Info/" + objurl);
    var _appkey = encodeURI("8aa2b327e51b44a0a5177b0e3f26fef4"); //你从腾讯获得的appkey
    var _pic = encodeURI("http://www.uibang.com" + objimg); //（例如：var _pic='图片url1|图片url2|图片url3....）
    var _site = 'http://www.uibang.com'; //你的网站地址
    var _u = 'http://v.t.qq.com/share/share.php?title=' + _t + '&url=' + _url + '&appkey=' + _appkey + '&site=' + _site + '&pic=' + _pic;
    window.open(_u, '', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
}
function postToSina(id, title) {
    var _u = "http://v.t.sina.com.cn/share/share.php?url=http://www.uibang.com/Info.ashx/Info/" + id + "&title=" + title + "&appkey=2924220432";
    window.open(_u, '', 'width=620, height=605, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
}
function postToQQ(id, title) {
    var _u = "http://shuqian.qq.com/post?from=3&uri=http://www.uibang.com/Info.ashx/Info/" + id + "&title=" + title + "&jumpback=2&noui=1";
    window.open(_u);
}
function postToBd(id, title) {
    var _u = "http://apps.hi.baidu.com/share/?url=http://www.uibang.com/Info.ashx/Info/" + id + "&title=" + title;
    window.open(_u);
}
function postToKx(id, title) {
    var _u = "http://www.kaixin001.com/repaste/share.php?rurl=http://www.uibang.com/Info.ashx/Info/" + id + "&rtitle=" + title + "&rcontent=" + title + " 详情：http://www.uibang.com/Info.ashx/Info/" + id;
    window.open(_u);
}
function postToTb(id, title) {
    var _u = "http://share.jianghu.taobao.com/share/addShare.htm?url=http://www.uibang.com/Info.ashx/Info/" + id + "&title=" + title + "&tag=&desc=";
    window.open(_u);
}
function GoContact(obj) {
    $("#" + obj).removeClass("divdisplay");
}
function noContact(obj) {
    $("#" + obj).addClass("divdisplay");
}
function Marked(obj, TID, Css1, Css2) {
    $.post('/Info.ashx/Mark', { TID: TID, time: Math.random() }, function (data) {
        if (data == 1) {
            $("#" + obj).removeClass(Css1);
            $("#" + obj).addClass(Css2);
            var Str = "<a href='javascript:void(0)' style='color:#067B06;' onclick='Markqx(\"" + obj + "\"," + TID + ",\"" + Css2 + "\",\"" + Css1 + "\")'>已关注</a>";
            $("#" + obj).html(Str);
        }
    });
}
function Markqx(obj, TID, Css1, Css2) {
    $.post('/Info.ashx/Markqx', { TID: TID, time: Math.random() }, function (data) {
        if (data == 1) {
            $("#" + obj).removeClass(Css1);
            $("#" + obj).addClass(Css2);
            var Str = "<a href='javascript:void(0)' onclick='Marked(\"" + obj + "\"," + TID + ",\"" + Css2 + "\",\"" + Css1 + "\")'>关注</a>";
            $("#" + obj).html(Str);
        }
    });
}
var topNews = "<a href='/Help.ashx/UserCheck' target='_blank'>怎样实名认证</a>　<a href='http://blog.uibang.com/post/tixian.html' target='_blank'>查看历史提现记录</a>　<a href='http://blog.uibang.com/post/headimg.html' target='_blank'>个人资料页面更新</a>";
