﻿var APP = { Request: { QueryString: function(val) { var uri = window.location.search; var re = new RegExp("" + val + "=([^&?]*)", "ig"); return ((uri.match(re)) ? (uri.match(re)[0].substr(val.length + 1)) : null) } }, insertTextArea: function(_AreaId, _Str, IsSelete) { $("#" + _AreaId).val((_Str) + $("#" + _AreaId).val()).focus() }, AutoScroll: function(Obj) { $(Obj).find("ul:first").animate({ marginTop: "-" + eval($(Obj).find("ul:first").find("li:first").height() + 6) + "px" }, 500, function() { $(this).css({ marginTop: "0px" }).find("li:first").appendTo(this) }) }, GoTop: function() { $('html,body').animate({ scrollTop: 0 }, 1000) }, FontSizeToBig: function(el) { $(el).animate({ fontSize: '18px' }, 1000, function() { APP.FontSizeRetion(el) }) }, FontSizeRetion: function(el) { $(el).animate({ fontSize: '12px' }, 1000, function() { APP.FontSizeToBig(el) }) }, ConverStr: function(str) { var s = ""; if (str.length == 0) return ""; s = str.replace(/&/g, "&gt;"); s = s.replace(/</g, "&lt;"); s = s.replace(/>/g, "&gt;"); s = s.replace(/   /g, "&nbsp;"); s = s.replace(/'/g, "‘"); s = s.replace(/"/g, "“"); s = s.replace(/\n/g, "<br/>"); s = s.replace(/\r/g, ""); return s }, StrLength: function(str) { var len = 0; for (var i = 0; i < str.length; i++) { if (str.charCodeAt(i) > 127) { len = len + 2 } else { len++ } } return len }, SubStr: function(str, num1, num2) { var bytes = 0; var retStr = ""; for (var i = 0; i < str.length; i++) { if (str.charCodeAt(i) > 127) { bytes = bytes + 2 } else { bytes++ } if (bytes < (num2 + 1) && bytes > (num1 - 1)) { retStr = retStr + str.charAt(i) } } return retStr }, AddFavorite: function(sURL, sTitle) { try { window.external.addFavorite(sURL, sTitle) } catch (e) { try { window.sidebar.addPanel(sTitle, sURL, "") } catch (e) { alert("加入收藏失败，请使用Ctrl+D进行添加") } } return false }, SetHome: function(obj, vrl) { try { obj.style.behavior = 'url(#default#homepage)'; obj.setHomePage(vrl) } catch (e) { if (window.netscape) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect") } catch (e) { alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'") } var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage', vrl) } else { alert("此操作被浏览器拒绝！\n\n请使用浏览器自身功能进行设置！") } } return false } }; var Eexin = new Object(); Eexin.UserId = ""; Eexin.ConverString = new Object(); Eexin.ConverString.Len = function(_str) { var l = _str.length; var n = l; for (var i = 0; i < l; i++) { if (_str.charCodeAt(i) < 0 || _str.charCodeAt(i) > 255) { n++ } } return n }; Eexin.ConverString.CheckIsNumber = function(_obj) { var Str = _obj; var re = /^[0-9]+.?[0-9]*$/; if (!re.test(Str)) { return false } return true }; Eexin.ConverString.CheckIsEmail = function(emailAddr) { if ((emailAddr == null) || (emailAddr.length < 2)) return false; var aPos = emailAddr.indexOf("@", 1); if (aPos < 0) { return false } if (emailAddr.indexOf(".", aPos + 2) < 0) { return false } return true }; Eexin.DataBaseBackup = function(el) { $(el).html("备份中..."); $.post("/Service/AjaxWebService.asmx/DataBaseBackup", {}, function(Msg) { alert($(Msg).find("string").text()); $(el).html("备份数据库") }) }; var DefaultLogo = new Object(); Eexin.DefaultLogo = { Shop: function(e) { e.src = "/Content/Images/D_S.jpg" }, User: function(Obj) { Obj.src = "/Content/Images/D_U.jpg" } }; DefaultLogo.User = function(Obj) { Obj.src = "/Content/Images/D_U.jpg" }; DefaultLogo.Shop = function(Obj) { Obj.src = "/Content/Images/D_S.jpg" }; Eexin.ShowWebServiceReturnStr = function(Obj) { Kitty.Alert("", $(Obj).find("string").text()) }; document.onkeydown = function(e) { if (e == null) { keycode = event.keyCode } else { keycode = e.which } switch (keycode) { case 27: $(".BG,.tc_box").hide(); break } }; Eexin.GetFace = function(Obj, _top, _left, ReceiveTag) { if ($(".tc_biaoqing").is(".tc_biaoqing")) { $(".tc_biaoqing").css({ top: _top, left: _left }); $(".tc_biaoqing").show().animate({ width: 280, height: 80 }, 300, function() { $(".tc_biaoqing a").focus() }); $(".tc_biaoqing").find(".OneFace").unbind("click").click(function() { $(ReceiveTag).val($(ReceiveTag).val() + $(this).attr("title")) }) } else { $.post("/Service/AjaxWebService.asmx/GetFace", { a: "d" }, function(Msg) { $("body").append($(Msg).find("string").text()); $(".tc_biaoqing").css({ top: _top, left: _left }); $(".tc_biaoqing a:last").focus().blur(function() { setTimeout(function() { $(".tc_biaoqing").animate({ width: 0, height: 0 }, 300, function() { $(this).hide() }) }, 300) }); $(".tc_biaoqing").find(".OneFace").unbind("click").click(function() { $(ReceiveTag).val($(ReceiveTag).val() + $(this).attr("title")) }) }) } }; Eexin.BindGetFace = function(Obj) { $(Obj).unbind("click").click(function(e) { Eexin.GetFace(this, e.pageY, e.pageX, $(this).attr("ReceiveTag")) }) }; Eexin.ShowBG = function() { $('.BG').height(window.screen.height).show() }; Eexin.ShowTC = function(obj, showbg) { if (showbg) { Eexin.ShowBG() } $(obj).animate({ opacity: 'toggle' }, 500) }; function ShowTC(obj, showbg) { if (showbg) { $('.BG').height(window.screen.height).show() } $(obj).animate({ opacity: 'toggle' }, 500) }; function ShowJinDuTiao(_T) { if (_T == null || _T == "") { _T = "请稍候" } Kitty.Alert(_T, "<div style='text-align:center'><img src='/Content/Images/LoadMsg.gif'></div>", "<a></a>") }; function AjaxSaveUserArea(_Id) { $.ajax({ type: "post", url: "/Service/AjaxWebService.asmx/SaveUserArea", data: { AreaId: _Id }, success: function() { top.location.reload() } }) }; function AjaxFollowing(_Uid, _FollowingUid, _IsDel, Obj) { if (_IsDel == null || _IsDel == "") { _IsDel = 0 } if (_Uid == null || _Uid == "") { _Uid = Eexin.UserId } if (_Uid == "" || _FollowingUid == '') { alert("关注出现异常，请刷新页面后重试~~"); return false } if (_FollowingUid == _Uid) { Kitty.Alert("温馨提醒", "自己不能关注自己~"); return false } if (Obj != null) { $(Obj).html("处理中...") } $.post("/Service/AjaxWebService.asmx/Following", { Uid: _Uid, FollowingUid: _FollowingUid, IsDel: _IsDel }, function(Msg) { var JsonData = eval("(" + $(Msg).find("string").text() + ")"); Kitty.Alert("温馨提醒", JsonData.State); if (_IsDel == 1) { $("#QuXiaoGuanZhuBut").hide(); $("#GuanZhuBut").show() } else { $("#GuanZhuBut").hide(); $("#QuXiaoGuanZhuBut").show() } }) }; Eexin.GuanZhuMoreUsers = function(_MyId, _UidStr, _But) { $.get("/Service/AjaxWebService.asmx/GuanZhuMoreUsers", { MyId: _MyId, UidStr: _UidStr }, function() { Kitty.Alert("", "关注成功~", _But) }) }; function ChangeClass(Obj) { $(Obj).parents('ul').find(".first").removeClass("first"); $(Obj).addClass("first"); $(Obj).blur() }; Eexin.ChangeClass_A = function(Obj) { $(Obj).parent().find(".first").removeClass("first"); $(Obj).addClass("first"); $(Obj).blur() }; function YaoQing() { Kitty.Alert("赶紧邀请你的朋友一起亿欣", "复制以下内容，用QQ、MSN、Gtalk等聊天工具发送给你的朋友<br>认识你身边的人，了解你身边的事儿，乐在其中！亿欣网-新生活  <a href=\"http://www.eexin.com\" >http://www.eexin.com</a>", "<input  type=\"button\" value=\"关闭\" onclick=\"$('.BG,.AlertDiv').hide();\" class=\"but\"/>&nbsp;&nbsp;&nbsp;&nbsp;<input  type=\"button\" value=\"复制\" onclick=\"FuZhi();\" class=\"but\"/>", 400) } function FuZhi() { Kitty.Copy("一个可以认识你邻居的地方，一个可以简单分享的地方，一个与众的不同的地方，这是一个你会立即喜欢上的地方，亿欣网-新生活 <a href='http://www.eexin.com' >http://www.eexin.com</a>") } Eexin.Login = { Email: "", JiZhu: 0, ConvertedPW: false, PassWord: "", ShowVal: false, AutoSubmit: function(_GoUrl, Div) { if (!Div) { Div = $("body") } if (this.Email == "" || this.PassWord == "") { Div.find("#LoginMsg").show(); return false } if (this.ShowVal) { Div.find("input[name='Email']").val(this.Email); Div.find("input[name='PassWord']").val(this.PassWord) } Div.find("#LoginMsg").html('正在发送登录请求 . . .').show(); $.post("/Service/AjaxWebService.asmx/Login", { Email: this.Email, PassWord: this.PassWord, Rember: this.JiZhu, ConvertedPW: this.ConvertedPW }, function(Msg) { var Rstr = $(Msg).find("string").text(); if (Rstr == "Success") { if (_GoUrl == null || _GoUrl == "") { top.location.reload() } else { top.location.href = _GoUrl } } else { Div.find("#LoginMsg").html(Rstr).show() } }) }, Submit: function(_GoUrl, Div) { if (!Div) { Div = $("body") } this.Email = Div.find("input[name='Email']").val(); this.PassWord = Div.find("input[name='PassWord']").val(); if (Div.find("input[name='Rember']").attr('checked')) { this.JiZhu = 1 } this.AutoSubmit(_GoUrl, Div) } }; Eexin.CheckEmailPass = false; Eexin.CheckXingMingPass = false; Eexin.CheckXingMingIsUse = function(_XM) { _XM = $.trim(_XM); if (_XM.length < 1) { $("#XingMingTip").html("× 昵称不能为空~").css("color", "Red"); return false } if (Eexin.ConverString.CheckIsNumber(_XM)) { $("#XingMingTip").html("× 昵称不能以数字开头~").css("color", "Red"); return false } if (_XM.substr(_XM.length - 1) == ".") { $("#XingMingTip").html("× 昵称不能以 . 结尾~").css("color", "Red"); return false } $.get("/Service/AjaxWebService.asmx/CheckXingMingIsUse", { XingMing: _XM }, function(Msg) { var IsUse = eval($(Msg).find("string").text()); if (IsUse) { $("#XingMingTip").html("× 昵称已经存在，请更换一个").css("color", "Red") } else { $("#XingMingTip").html("^_^ 昵称可以使用").css("color", "Green"); Eexin.CheckXingMingPass = true } }) }; Eexin.CheckEmailIsUse = function(_Email) { if (!Eexin.ConverString.CheckIsEmail(_Email)) { $("#EmailTip").html("× 邮箱格式不正确 ").css("color", "Red"); return false } $.get("/Service/AjaxWebService.asmx/CheckEmailIsUse", { Email: _Email }, function(Msg) { var IsUse = eval($(Msg).find("string").text()); if (IsUse) { $("#EmailTip").html("× 邮箱不能为空或已经注册，忘记密码请点击 <a href=\"javascript:;\" onclick=\"FindPassWord.Show(); return false;\">找回密码</a> ").css("color", "Red") } else { $("#EmailTip").html("^_^ 邮箱可以使用").css("color", "Green"); Eexin.CheckEmailPass = true } }) }; Eexin.OnClickShowBigPhoto = function(PhotoClass) { jQuery.fn.fancybox.defaults.path = '/Scripts/fancybox/'; var SmallBlogContentImgGroup = $(PhotoClass).get(); for (var i = 0; i < SmallBlogContentImgGroup.length; i++) { SmallBlogContentImgGroup[i].id = "SmallBlogContentImgGroup_" + i } $(PhotoClass).fancybox({ 'fancy': true, 'speed': 750 }) }; Eexin.SetImgMaxWidth = function(_Box, MaxW) { $(_Box).find("img").each(function(i) { if (this.width > MaxW) { this.width = MaxW } }) }; function BindShowLoginWin() { $(".MustLogin").unbind().click(function() { $(this).blur(); Eexin.ShowBG(); $(".LoginDiv").animate({ opacity: 'toggle' }, 300); return false }); $(".MustLogin").find("*").unbind().click(function() { $(this).blur(); Eexin.ShowBG(); $(".LoginDiv").animate({ opacity: 'toggle' }, 300); return false }) }; Eexin.InsertHaTi = function(ObjId) { APP.insertTextArea(ObjId, "#插入话题# ", true) }; Eexin.Tag = new Object(); Eexin.Tag.GuanZhu = function(_TagId, _IsDel, Obj) { $.post("/Service/AjaxWebService.asmx/Tag_GuanZhu", { Uid: Eexin.UserId, TagId: _TagId, IsDel: _IsDel }, function() { if (_IsDel) { $(Obj).unbind().click(function() { Eexin.Tag.GuanZhu(_TagId, false, Obj) }).html("关注该话题"); $("#tip").hide() } else { $(Obj).unbind().click(function() { Eexin.Tag.GuanZhu(_TagId, true, Obj) }).html("取消关注"); $("#tip").show() } }) }; Eexin.FindPassWord = new Object(); Eexin.FindPassWord.Show = function() { Kitty.Alert("通过邮箱找回密码", "请在下面输入注册时的邮箱，我们将把修改密码链接发送到您的邮箱！ <br/> <br/>邮箱：<input type='text' class='FindPassWordEmail'>    <span id='State'></span><br/>", "<input type='button' value='发送' class='but' onclick='Eexin.FindPassWord.Send($(\".FindPassWordEmail\").val())'>", 400) }; Eexin.FindPassWord.Send = function(_Email) { if (_Email.length < 3) { $("span#State").html("Email格式不正确"); return false } $("span#State").html("传送中. . ."); $.get("/Service/AjaxWebService.asmx/FindPassWord", { Email: _Email }, function(Msg) { var Re = $(Msg).find("string").text(); if (Re == "Success") { alert("我们已经将修改密码的链接发送至您的邮箱，请根据此链接进行修改密码！"); $('.BG,.AlertDiv').hide() } else { $("span#State").html(Re) } }) }; Eexin.BuLuo = new Object(); Eexin.BuLuo.Join = function(_Bid) { var _LiYou = $("#JoinBuLuoLiYou").val(); if (_LiYou == "") { alert("您必须输入加入理由！"); return } $.post("/Service/AjaxBuLuoWS.asmx/Join", { Bid: _Bid, LiYou: _LiYou }, function(Msg) { Eexin.ShowWebServiceReturnStr(Msg); $(".yixin").unbind(); $("#JiaRuAndTuiChu").html("已加入，<a href=\"javascript:;\" onclick=\"Eexin.BuLuo.Exit('" + _Bid + "')\">退出</a>") }) }; Eexin.BuLuo.Exit = function(_Bid) { $.post("/Service/AjaxBuLuoWS.asmx/Exit", { Bid: _Bid }, function(Msg) { Eexin.ShowWebServiceReturnStr(Msg); $("#JiaRuAndTuiChu").html("<a href=\"javascript:;\" onclick=\"Eexin.ShowTC('#JiaRuBuLuoDiv',true);\">加入该部落</a>") }) }; Eexin.BuLuo.TuiJian = function(_Name) { $.post("/Service/AjaxBuLuoWS.asmx/TuiJian", { Name: _Name }, function(Msg) { Eexin.ShowWebServiceReturnStr(Msg) }) }; Eexin.GuoLvMsg = function() { $('.pinglun').empty(); $(".LoadMsgHref").click() }; Eexin.BuLuo.Create = function() { _Name = $.trim($("#BuLuoName").val()); _LiYou = $("#BuLuoLiYou").val(); if (_Name == "") { Kitty.Alert("", "请输入部落名称！"); return } if (_LiYou == "") { Kitty.Alert("", "请输入创建部落的理由！"); return } _Name = _Name.replace('&', '﹠'); $.post("/Service/AjaxBuLuoWS.asmx/Create", { Name: _Name, LiYou: _LiYou }, function(Msg) { if ($(Msg).find("string").text() != "Success") { Eexin.ShowWebServiceReturnStr(Msg) } else { Kitty.Alert("", "部落创建成功！", "<input  type=\"button\" value=\"查看部落\" onclick=\"top.location.href='/b/" + _Name + "';\" class=\"but m_r10 But1\"/>") } }) }; Eexin.ShuYouHui = { ShenQingJoin: function() { var Book1, Book2, Book3, ShuoMing1, ShuoMing2, ShuoMing3, XingQu, MyJieShao; Book1 = $("input[name='Book1']").val(); Book2 = $("input[name='Book2']").val(); Book3 = $("input[name='Book3']").val(); ShuoMing1 = $("input[name='ShuoMing1']").val(); ShuoMing2 = $("input[name='ShuoMing2']").val(); ShuoMing3 = $("input[name='ShuoMing3']").val(); if (Book1 == "" || Book2 == "" || Book3 == "") { Kitty.Alert("", "请分享3本图书！"); return } XingQu = $("textarea[name='XingQu']").val(); if (XingQu == "") { Kitty.Alert("", "请输入您的兴趣！"); return } MyJieShao = $("textarea[name='MyJieShao']").val(); if (MyJieShao == "") { Kitty.Alert("", "请输入您自己的介绍！"); return } $.post("/Service/AjaxShuWS.asmx/JoinShuYouHui", { Uid: Eexin.UserId, B1: Book1, S1: ShuoMing1, B2: Book2, S2: ShuoMing2, B3: Book3, S3: ShuoMing3, XQ: XingQu, JS: MyJieShao }, function(Msg) { top.location.reload() }) }, ZhuCe: function() { Kitty.Alert("", "郑州·周末书友会 在线平台由亿欣生活强力驱动，请点击确定之后在新注册页面注册之后刷新本页面。", "<a target='_blank' href='/Home/Reg' class='but'>现在注册</a>", 400) }, CanJia: function(_Uid, _Issue) { $.post("/Service/AjaxShuWS.asmx/CanJia", { Uid: _Uid, Issue: _Issue }, function(Msg) { top.location.reload() }) }, BookAddCheck: function() { var Bn = $("input#BookName"); if (Bn.val() == "") { Bn.css({ backgroundColor: "#ff6400" }); setTimeout(function() { Bn.css({ backgroundColor: "#fff" }) }, 100); return false } return true }, BookCommentCheck: function() { if ($("#Msg").val() == "") { Kitty.Alert("", "请输入书评内容！"); return false } return true }, BookDel: function(_BookId) { if (confirm("确定要删除此书籍吗？（不可恢复）")) { $.post("/Service/AjaxShuWS.asmx/ShuYouHuiBookDel", { BookId: _BookId }, function() { $("tr#BookShelfTr" + _BookId).remove() }) } } }; Eexin.Search = new Object(); Eexin.Search.Url = "/U/Search/"; Eexin.Search.Submit = function(_val) { if (_val == "") { alert('请输入关键字！'); return } top.location.href = Eexin.Search.Url + _val }; Eexin.Shop = new Object(); Eexin.Shop.ShowDiTu = function(_x, _y) { $(".Area_Title").hide(); $("#ShowDiTiA").click(); ShowTC('.ChoseArea', true); $(this).blur(); Mapinitialize(_x, _y, true) }; Eexin.Shop.GuanZhu = function(_ShopId, _State) { if (Eexin.UserId == "") { alert("尚未登录或者登录超时！"); return } $.post("/Service/AjaxShopWS.asmx/GuanZhu", { UserId: Eexin.UserId, ShopId: _ShopId, State: _State }, function(Msg) { Eexin.ShowWebServiceReturnStr(Msg); if (_State == 1) { $("#GuanZhu_a").hide(); $("#QuXiaoGuanZhu_a").show() } else { $("#QuXiaoGuanZhu_a").hide(); $("#GuanZhu_a").show() } }) }; Eexin.Shop.TuiJian = function(_shopid) { $.post("/Service/AjaxShopWS.asmx/TuiJian", { ShopId: _shopid }, function(re) { Eexin.ShowWebServiceReturnStr(re) }) }; Eexin.Shop.SmallBlgo_del = function(_Shopid, e) { $.post("/Service/AjaxShopWS.asmx/SmallBlog_del", { Sid: _Shopid }, function() { e.parents(".pl_list").hide(1000) }) }; Eexin.Shop.SmallBlogReply = function(_SmallBlogId, e) { if (Eexin.UserId == "") { alert("尚未登录或者登录超时！"); return } var Con = $("#ReplyContent_" + _SmallBlogId).val(); if (Con != "" && Eexin.UserId != "") { $.post("/Service/AjaxShopWS.asmx/SmallBlog_Comment_Add", { SmallBlogId: _SmallBlogId, Uid: Eexin.UserId, Comment: Con }, function(Msg) { var Json = eval("(" + $(Msg).find("string").text() + ")"); if (Json.state == "Success") { e.parents(".pl_list").find(".PlShow").append(unescape(Json.msg)); $("#ReplyContent_" + _SmallBlogId).val("") } else { alert(Json.state) } }) } }; Eexin.Shop.SmallBlogReply_Del = function(_Cid, e) { $.post("/Service/AjaxShopWS.asmx/SmallBlogReply_Del", { Cid: _Cid }, function() { e.parents(".hf").hide(1000) }) }; Eexin.Shop.SmallBlogReply_Load = function(_Sid, e) { $(e).hide(); $("#PlShow" + _Sid + ",#HuiFuInputDiv" + _Sid + ",ShouQiPL" + _Sid).show(); $("#ReplyContent_" + _Sid).focus(); $.post("/Service/AjaxShopWS.asmx/LoadReply", { SmallBlogId: _Sid }, function(Msg) { $("#PlShow" + _Sid).html($(Msg).find("string").text()); $(".MeHide_" + Eexin.UserId).hide(); $(".MeShow_" + Eexin.UserId).show(); $(".hf").hover(function() { $(this).find(".DoBut").show() }, function() { $(this).find(".DoBut").hide() }); if (Eexin.UserId == null || Eexin.UserId == "") { $(".MustLogin").find("a").removeAttr("onclick"); $(".MustLogin").find("*").focus(function() { $(this).blur(); $(".BG,.LoginDiv").show(); return false }) } }) }; Eexin.Shop.SetTop = function(_ShopId, _SmallBlogId) { $.post("/Service/AjaxShopWS.asmx/SetTop", { Sid: _SmallBlogId, ShopId: _ShopId }, function() { top.location.reload() }) }; Eexin.Shop.Shop_Del = function(_Sid) { $.post("/Service/AjaxShopWS.asmx/Shop_Del", { Sid: _Sid }, function() { alert("服务已经删除！"); top.location.href = "/Home" }) }; Eexin.Shop.CreateShop = function() { if ($("input[name='ShopName']").val() == "") { Kitty.Alert("", "请输入店铺名称！"); return false } if ($("textarea[name='Info']").val() == "") { Kitty.Alert("", "请输入店铺的简介！"); return false } if ($("input[name='AreaId']").val() == "") { Kitty.Alert("", "请选择店铺的位置！"); return false } $("#CreateShop").submit() }; Eexin.HuoDong = new Object(); Eexin.HuoDong.Join = function(_Hn, _Uid) { $.post("/Service/AjaxWebService.asmx/HuoDong_Join", { HuoDongName: _Hn, Uid: _Uid }, function(re) { Eexin.ShowWebServiceReturnStr(re); $(".CanJiaBut").remove() }) }; Eexin.Event = { Check: function() { if ($("#Name").val() == "") { alert("请输入活动名称！"); $("#Name").focus(); return false } if ($("#EventTime").val() == "") { alert("请选择活动时间！"); $("#EventTime").focus(); return false } if ($("#Info").val() == "") { alert("请对活动进行说明！"); $("#Info").focus(); return false } return true }, Join: function(Eid) { if (Eexin.UserId == "") { alert("您尚未登录或者登录已超时，请重新登录！") } $.post("/Service/AjaxWebService.asmx/EventJoin", { Eid: Eid, Uid: Eexin.UserId }, function() { $("#EventJoinNum").html(eval($("#EventJoinNum").html()) + 1); $("#JoinA").hide(); $("#ExitA").show() }) }, Exit: function(Eid) { if (Eexin.UserId == "") { alert("您尚未登录或者登录已超时，请重新登录！") } $.post("/Service/AjaxWebService.asmx/EventExit", { Eid: Eid, Uid: Eexin.UserId }, function() { $("#EventJoinNum").html(eval($("#EventJoinNum").html()) - 1); $("#JoinA").show(); $("#ExitA").hide() }) }, TuiJian: function(_Info) { $.post("/Service/AjaxWebService.asmx/EventTuiJian", { Info: _Info }, function() { Kitty.Alert("", "成功推荐给了欣友！") }) } }; Eexin.Map = { map: null, mag: null, Markerarr: [], Mapinitialize: function() { Eexin.Map.map = new GMap2(document.getElementById("map")); Eexin.Map.map.addControl(new GSmallZoomControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(5, 5))); Eexin.Map.map.enableScrollWheelZoom(); Eexin.Map.map.disableDoubleClickZoom(); var _x, _y, center; if (_x == null) { _x = 34.7868361111 } if (_y == null) { _y = 113.6875805556 } center = new GLatLng(_x, _y); Eexin.Map.map.setCenter(center, 13); Eexin.Map.mag = new MarkerManager(Eexin.Map.map) }, SetMarker: function(x, y) { if (x == "" || y == "") { return } var center = new GLatLng(x, y); if (center) { Eexin.Map.Markerarr.push(new GMarker(center)); Eexin.Map.mag.addMarkers(Eexin.Map.Markerarr, 7, 17); Eexin.Map.mag.refresh(); Eexin.Map.map.setCenter(center, 13) } }, CreateMarker: function(_x, _y, _content) { var Marker = new GMarker(new GLatLng(_x, _y)); GEvent.addListener(Marker, "mouseover", function() { Marker.openInfoWindowHtml(_content) }); return Marker }, SetMarkerJson: function(JsonData) { for (var i = 0; i < JsonData.length; i++) { this.Markerarr.push(this.CreateMarker(JsonData[i].x, JsonData[i].y, JsonData[i].content)) } this.mag.addMarkers(this.Markerarr, 9, 17); this.mag.refresh() }, ClickBiaoZhu: function() { GEvent.addListener(Eexin.Map.map, "click", function(overlay, latlng) { if (latlng) { var NewMarker = new GMarker(latlng); Eexin.Map.Markerarr = []; Eexin.Map.mag.clearMarkers(); Eexin.Map.Markerarr.push(NewMarker); Eexin.Map.mag.addMarkers(Eexin.Map.Markerarr, 13, 17); Eexin.Map.mag.refresh(); $(".x").val(latlng.x); $(".y").val(latlng.y) } }) }, DoubleClickSearch: function() { GEvent.addListener(Eexin.Map.map, "dblclick", function(overlay, latlng) { if (latlng) { Eexin.Map.mag.clearMarkers(); $.post("/Service/AreaWebService.asmx/SearchArea", { X: latlng.y, Y: latlng.x, ReturnTypes: "Json" }, function(Msg) { var Json = eval($(Msg).find("string").text()); if (Json) { Eexin.Map.Markerarr = []; for (var i = 0; i < Json.length; i++) { Eexin.Map.Markerarr.push(Eexin.Map.CreateMarker(Json[i].X, Json[i].Y, "名称：" + Json[i].Name + "<br/>地址：" + unescape(Json[i].Address))) } Eexin.Map.mag.addMarkers(Eexin.Map.Markerarr, 12, 17); Eexin.Map.mag.refresh() } }) } }) } }; Eexin.Admin = { SetLevel: function(_Uid, _Level) { $.post("/Service/AjaxWebService.asmx/User_Level_Set", { Uid: _Uid, Level: _Level }, function(Msg) { var Re = $(Msg).find("string").text(); if (Re != "") { alert(Re) } }) }, BindEventShop: function(_ShopId, _EventId, Obj) { if (_ShopId == "") { alert("请输入生活空间的ID"); return } var RongQi = $(Obj).parent().parent().find(".StateSpan"); $.post("/Service/AjaxWebService.asmx/BindEventShopId", { EventId: _EventId, ShopId: _ShopId }, function(Msg) { var Re = $(Msg).find("string").text(); if (Re != "Success") { alert(Re); return } else { if (_ShopId == "0") { RongQi.html("无 (<a onclick=\"$('.BindSpan').hide(); $(this).parent().parent().find('.BindSpan').show(); return false;\">关联</a>)") } else { RongQi.html("<a href=\"/Shop/" + _ShopId + "\" target=\"_blank\" class=\"Color_Green\">已绑定，查看</a> <a onclick=\"$('.BindSpan').hide(); $(this).parent().parent().find('.BindSpan').show(); return false;\">编辑</a>") } $(".BindSpan").hide() } }) }, BindShopDoMain: function(_ShopId, Obj) { var _DoMain = $(Obj).prev().val(); if (_DoMain == "") { alert("请输入域名！") } $.post("/Service/AjaxWebService.asmx/BindShopDoMain", { DoMain: _DoMain, ShopId: _ShopId }, function(Msg) { var Re = $(Msg).find("string").text(); if (Re != "Success") { alert(Re); return } else { $(".DoMainEditSpan").hide(); $(Obj).parents("td").find(".DoMain").html(_DoMain) } }) }, SetShopIsTop: function(_Top, _ShopId, Obj) { $.post("/Service/AjaxWebService.asmx/SetShopTop", { Top: _Top, ShopId: _ShopId }, function() { var RongQi = $(Obj).parent(); if (_Top == 1) { RongQi.html('已推荐，<a href="" class="Color_Red" onclick="Eexin.Admin.SetShopIsTop(0,' + _ShopId + ',this); return false;">取消</a>') } else { RongQi.html('<a href="" class="Color_Green" onclick="Eexin.Admin.SetShopIsTop(1,' + _ShopId + ',this); return false;">设为推荐</a>') } }) } }; Eexin.AutoComplete = { Loading: false, LastKey: '', Selected: null, UpAndDownKey: function(o, c, event) { var cd = event.keyCode; if (cd != 38 && cd != 40) { return } this.Selected = c.find(".MouseDown"); if (cd == 38) { if (this.Selected.size() < 1) { selected = c.find("li:last-child").prev(); this.Selected = c.find("li:last-child"); this.Selected.addClass("MouseDown") } else { this.Selected.removeClass("MouseDown"); this.Selected = this.Selected.prev("li"); this.Selected.addClass("MouseDown") } } else { if (this.Selected.size() < 1) { this.Selected = c.find("li:first-child"); this.Selected.addClass("MouseDown") } else { this.Selected.removeClass("MouseDown"); this.Selected = this.Selected.next("li"); this.Selected.addClass("MouseDown") } } o.val(this.Selected.find("a").html()); return }, LoadStart: function(o, event) { if (event.keyCode == 13 || event.keyCode == 38 || event.keyCode == 40) { return } if (this.Loading || this.LastKey == o.val() || o.val() == '') { return } this.LastKey = o.val(); this.Loading = true; $.post("/Service/AjaxWebService.asmx/SearchUser", { Key: this.LastKey }, function(Msg) { Msg = $(Msg).find("string").text(); if (Msg != "") { if ($(".AutoList").size() < 1) { $("body").append("<ul class='AutoList'></ul>") } var c = $(".AutoList"); c.css({ "top": o.offset().top + o.height() + 3, "left": o.offset().left, "width": o.width() + 5 }); c.empty(); c.html(Msg); c.find("li").hover(function() { c.find(".MouseDown").removeClass("MouseDown"); $(this).addClass("MouseDown") }, function() { $(this).removeClass("MouseDown") }); o.blur(function() { setTimeout(function() { c.remove() }, 500) }) } else { $(".AutoList").remove() } Eexin.AutoComplete.Loading = false }) } }; Eexin.User = { ActivateArea: function(HomeOrOffice) { $.ajax({ url: "/Service/AreaWebService.asmx/ActivateArea", type: "POST", data: { HomeOrOffice: HomeOrOffice }, error: function() { alert("操作出现异常，请稍后再试！") } }) } }; Eexin.NPC = { JoinEvent: function(Eid) { $.ajax({ url: "/Service/AjaxWebService.asmx/NPCJoinEvent", type: "POST", data: { Eid: Eid }, success: function() { alert("调用成功！") }, error: function() { alert("调用失败！") } }) } };