option explicit
On Error Resume Next

public count_shua,autoFenShua,cnt_SPtrigger,cnt_arr
count_shua=0
autoFenShua=false
cnt_SPtrigger=0
cnt_arr=0
'auto_SPtrigger = false

public arrCntSP(1)
arrCntSP(0)=0
arrCntSP(1)=0

public arrSP(6,1)
public arrPic()

PUBLIC autoemcee
autoemcee = 0

public sTime,eTime,uTime

public autoxh
autoxh = 100
public autozdxh
autozdxh=0

public getmic_uid
getmic_uid = 0

public autozsmic
autozsmic = 0

PUBLIC PointLevel(6)
PointLevel(0) = "二级贫民"	
PointLevel(1) = "三级小康"	
PointLevel(2) = "四级财主"	
PointLevel(3) = "百万富翁"	
PointLevel(4) = "千万富翁"	
PointLevel(5) = "SAY聊首富"

PUBLIC Face(100,3)
PUBLIC CONST  NUMFACE = 100
Face(1,0) = "?"
Face(1,1) = "很疑惑的看着对象... "
Face(1,2) = "抓了抓头皮，露出迷惑的神情...."
Face(1,3) = "疑惑"
Face(2,0) = ":)"
Face(2,1) = "脸上露出了一丝笑容"
Face(2,2) = "对对象露出愉快的表情"
Face(2,3) = "微笑"
Face(3,0) = ":("
Face(3,1) = "一脸的晦气，好象谁牵走了他的牛"
Face(3,2) = "一肚子苦水向对象倒了出来 :(((((((((((((( "
Face(3,3) = "晦气"
Face(4,0) = "??"
Face(4,1) = "抓呀抓，把头皮都抓破了，也没有想出个所以然来。"
Face(4,2) = "被对象底话弄得晕头转向，稀里糊涂的。"
Face(4,3) = "晕头转向"
Face(5,0) = ":p"
Face(5,1) = "在血盘大口里吐了吐青白的舌头！"
Face(5,2) = "对对象惊讶得吐出了舌头 ..."
Face(5,3) = "吐舌头"
Face(6,0) = ":D"
Face(6,1) = "耶...又一个反肚乌龟耶...:DDD"
Face(6,2) = ""
Face(6,3) = "嘲笑"
Face(7,0) = "8d8d"
Face(7,1) = "腮上飞红，秋波闪动，动情地说：所有人让我们交个朋友吧!  "
Face(7,2) = ""
Face(7,3) = "动情"
Face(8,0) = "@@"
Face(8,1) = "眨眨眼！一对会说话的眼睛闪闪动人"
Face(8,2) = "大大的眼睛， 天真的望著对象... (@_@)"
Face(8,3) = "眨眼睛"
Face(9,0) = "aah"
Face(9,1) = "重重地拍了一下脑袋，终於想到了！"
Face(9,2) = ""
Face(9,3) = "恍然大悟"
Face(10,0) = "addoil"
Face(10,1) = "使劲给自已加油！"
Face(10,2) = "憋足了劲大喊：对象！加油！加油！下面就是宝贝了！"
Face(10,3) = "加油"
Face(11,0) = "admire"
Face(11,1) = "抱拳团团一拜道：“敝人对各位的景仰之情，有如涛涛江水连绵不绝。”"
Face(11,2) = ""
Face(11,3) = "敬仰"
Face(12,0) = "agree"
Face(12,1) = "完全同意。"
Face(12,2) = "完全同意对象的看法。"
Face(12,3) = "同意"
Face(13,0) = "agree2"
Face(13,1) = "觉得就自己最对，一贯正确，别人都是扯蛋..."
Face(13,2) = ""
Face(13,3) = "非常肯定"
Face(14,0) = "ah"
Face(14,1) = "惊讶地“啊！”了一声。"
Face(14,2) = "对着对象惊讶地「啊！」了一声。"
Face(14,3) = "惊讶"
Face(15,0) = "ahh"
Face(15,1) = "重重地拍了一下自己的脑袋，“我怎麽没想到？！”"
Face(15,2) = ""
Face(15,3) = "后悔"
Face(16,0) = "angry"
Face(16,1) = "作出生气的表情！火冒三丈～想要打人～"
Face(16,2) = "脸臭臭的， 一副懒得理对象的模样。"
Face(16,3) = "生气"
Face(17,0) = "ann"
Face(17,1) = "大吼一声：天帝来了！把在场的所有人都吓得发抖"
Face(17,2) = ""
Face(17,3) = "吓别人"
Face(18,0) = "applaud"
Face(18,1) = "啪啪啪啪啪啪啪……"
Face(18,2) = ""
Face(18,3) = "鼓掌"
Face(19,0) = "away"
Face(19,1) = "无从参与，唯有告辞。"
Face(19,2) = ""
Face(19,3) = "无奈"
Face(20,0) = "allen"
Face(20,1) = ""
Face(20,2) = "向对象用力将鸡蛋扔去。“啪！”好爽！"
Face(20,3) = "扔鸡蛋"
Face(21,0) = "bad"
Face(21,1) = "“完了，我要做个堕落天使，到地狱去找哈哈，我的最爱！”"
Face(21,2) = "噪着对象“坏坏，欺负人！！”"
Face(21,3) = "你真坏"
Face(22,0) = "bb"
Face(22,1) = "越来越年轻"
Face(22,2) = "抱着对象轻轻摇晃，“小宝宝，食蛋糕。”"
Face(22,3) = "宝宝"
Face(23,0) = "bbb"
Face(23,1) = "很想邀请人对聊啦~"
Face(23,2) = "BB...BBB...唉...又要去复机啦！等我哦！对象"
Face(23,3) = "好想聊"
Face(24,0) = "beaut"
Face(24,1) = "觉得自己挺臭美"
Face(24,2) = "指着对象的鼻子说，看把你美的，整个一大傻冒儿...."
Face(24,3) = "臭美"
Face(25,0) = "b_hi"
Face(25,1) = "大咧咧地说：大姐姐，小姐姐！本公子这厢有礼啦！"
Face(25,2) = ""
Face(25,3) = "施礼"
Face(26,0) = "bear"
Face(26,1) = "往洞里一躺，嘟咙到：“熊熊我要冬眠了，不要打搅我！”"
Face(26,2) = ""
Face(26,3) = "睡觉"
Face(27,0) = "bicycle"
Face(27,1) = "推出了一辆‘吱吱’作响的自行车，梦想骑上它在本站一游。"
Face(27,2) = ""
Face(27,3) = "闲逛"
Face(28,0) = "bigfool"
Face(28,1) = "“我是成奎安我怕谁！”"
Face(28,2) = ""
Face(28,3) = "不怕"
Face(29,0) = "birthday"
Face(29,1) = "逢人就打招呼：大家好，今天是我的生日！请吃糖！ 请吃糖！"
Face(29,2) = "祝对象生日快乐， 献花！"
Face(29,3) = "生日快乐"
Face(30,0) = "bite"
Face(30,1) = "磨了磨牙 ..."
Face(30,2) = "张开血盆大口，狠狠地咬了下去， 把对象咬的哇哇大叫。"
Face(30,3) = "咬人"
Face(31,0) = "bless"
Face(31,1) = "默默地祝福着..."
Face(31,2) = "祝福对象心想事成"
Face(31,3) = "祝福"
Face(32,0) = "blush"
Face(32,1) = "脸都红了，恨没有地洞，好钻进去躲起来~~"
Face(32,2) = "对着对象说：羞羞脸！"
Face(32,3) = "害羞"
Face(33,0) = "boring"
Face(33,1) = "觉得话题沉闷，只有坐在一旁发呆..."
Face(33,2) = ""
Face(33,3) = "没意思"
Face(34,0) = "bow"
Face(34,1) = "一鞠躬，二鞠躬，三鞠躬...."
Face(34,2) = "毕恭毕敬的向对象弯腰鞠躬"
Face(34,3) = "鞠躬"
Face(35,0) = "boy"
Face(35,1) = "双眼一翻：“大丈夫可杀不可辱……”"
Face(35,2) = ""
Face(35,3) = "大丈夫"
Face(36,0) = "brag"
Face(36,1) = "把胸脯拍得噼啪响：“武林中拳头大的说话，有种的上来比划比划！”"
Face(36,2) = ""
Face(36,3) = "挑衅"
Face(37,0) = "brag2"
Face(37,1) = "双眼一翻：“大丈夫可杀不可辱……” "
Face(37,2) = ""
Face(37,3) = "不怕"
Face(38,0) = "brag3"
Face(38,1) = "大吼一声：“老子今天就是死，也要拉几个垫背的！！！”"
Face(38,2) = ""
Face(38,3) = "拚了"
Face(39,0) = "breath"
Face(39,1) = "感觉呼吸越来越..."
Face(39,2) = "赶快给对象做人工呼吸！"
Face(39,3) = "不行了"
Face(40,0) = "brother"
Face(40,1) = "弯弯腰，道了个万福“各位大哥，有礼了！”"
Face(40,2) = ""
Face(40,3) = "有礼了"
Face(41,0) = "buddha"
Face(41,1) = "在这一瞬间，觉得自己简直跟神一样。"
Face(41,2) = ""
Face(41,3) = "感觉很好"
Face(42,0) = "bug"
Face(42,1) = "嘴角一撇，狞笑道：“我是害虫我怕谁？！”"
Face(42,2) = "大叫“对象，你这条臭虫！” ..."
Face(42,3) = "虫虫"
Face(43,0) = "bye"
Face(43,1) = "回眸一笑，一切尽在不言中 "
Face(43,2) = "对对象说道：再见！"
Face(43,3) = "再见"
Face(44,0) = "byeall"
Face(44,1) = "向在场的人道别：走咯！ 我会想你们的。"
Face(44,2) = ""
Face(44,3) = "走了"
Face(45,0) = "cat"
Face(45,1) = "“喵～！ 喵～～！”"
Face(45,2) = "靠在对象的耳朵旁边“喵～！ 喵～～”"
Face(45,3) = "猫猫"
Face(46,0) = "care"
Face(46,1) = "孤独寂寞地躲在角落痛哭 ~~&gt;_&lt;~~"
Face(46,2) = "轻轻抚摸对象"
Face(46,3) = "寂寞"
Face(47,0) = "caress"
Face(47,1) = "觉得自已好可怜..."
Face(47,2) = "抚摸对象"
Face(47,3) = "可怜啊"
Face(48,0) = "caxie"
Face(48,1) = "以一个优雅的动作拨了下头发..."
Face(48,2) = "拿出一块破抹布，一脸妩媚地给对象擦鞋..."
Face(48,3) = "献媚"
Face(49,0) = "clap"
Face(49,1) = "“啪啪啪啪啪啪啪啪！！”"
Face(49,2) = "向对象热烈鼓掌"
Face(49,3) = "好"
Face(50,0) = "club"


PUBLIC TextFont(6)
PUBLIC CONST  FONTNUM = 6
TextFont(1) = "宋体"
TextFont(2) = "黑体"
TextFont(3) = "楷体"
TextFont(4) = "隶书"
TextFont(5) = "仿宋"
TextFont(6) = "新宋体"
PUBLIC TextColor(6)
PUBLIC CONST TextColorNum = 6
TextColor(1) = "#FF00FF"
TextColor(2) = "#66FF99"
TextColor(3) = "#FF0033"
TextColor(4) = "#0033FF"
TextColor(5) = "#000033"
TextColor(6) = "#663333"
PUBLIC TextBColor(6)
PUBLIC CONST TextBColorNum = 6
TextBColor(1) = "#CCFFFF"
TextBColor(2) = "#CCCCFF"
TextBColor(3) = "#FFCCFF"
TextBColor(4) = "#FF99FF"
TextBColor(5) = "#CCCCCC"
TextBColor(6) = "#CCFF66"
PUBLIC bgC(6,6)
PUBLIC CONST bgCNum = 6
bgC(1,1) = "#FAE5EB"         '窗体颜色
bgC(1,2) = "#FAE5EB"         '名字列表颜色
bgC(1,3) = "#FFFFFF"         '主文字窗口颜色
bgC(1,4) = "#FFFFFF"         '分屏窗口颜色
bgC(1,5) = "#FFC0CB"         '控制面板颜色
bgC(1,6) = "默认"            '方案名称
bgC(2,1) = "#E5DDD4"
bgC(2,2) = "#E5DDD4"
bgC(2,3) = "#FFFFFF"
bgC(2,4) = "#FFFFFF"
bgC(2,5) = "#A28B75"
bgC(2,6) = "方案一"
bgC(3,1) = "#DEDEDE"
bgC(3,2) = "#DEDEDE"
bgC(3,3) = "#FFFFFF"
bgC(3,4) = "#FFFFFF"
bgC(3,5) = "#8D8D8D"
bgC(3,6) = "方案二"
bgC(4,1) = "#D2EAD2"
bgC(4,2) = "#D2EAD2"
bgC(4,3) = "#FFFFFF"
bgC(4,4) = "#FFFFFF"
bgC(4,5) = "#6EAD6E"
bgC(4,6) = "方案三"
bgC(5,1) = "#E2CFEC"
bgC(5,2) = "#E2CFEC"
bgC(5,3) = "#FFFFFF"
bgC(5,4) = "#FFFFFF"
bgC(5,5) = "#7E68BC"
bgC(5,6) = "方案四"
bgC(6,1) = "#CBE4F6"
bgC(6,2) = "#CBE4F6"
bgC(6,3) = "#FFFFFF"
bgC(6,4) = "#FFFFFF"
bgC(6,5) = "#449EDD"
bgC(6,6) = "方案五"
PUBLIC arrApplause(23)
PUBLIC CONST APPLAUSENUM = 23
arrApplause(1) = "◥◣★☆★◢◤★↘*郁金香∴→◥◣★☆★◢◤★℡↘*郁金香∴→◥◣★☆★◢◤★ ↘ *郁金香∴→◥◣★☆★◢◤★↘*郁金香∴→◥◣★☆★◢◤★↘ *郁金香∴→"
arrApplause(2) = "★☆ぷ╰☆╮ぷ camation（康乃馨）★☆ぷ╰☆╮tulip（郁金香）★☆ぷ╰☆╮ぷ daffodil（水仙花）★☆ぷ╰☆╮ぷ violet（紫罗兰)"
arrApplause(3) = "掌声为你响起°★．★·°∴° ∴°★．° ．最棒的歌手·。∴．★·°∴° ∴°★．° ．·。∴．太棒了★·°∴° ∴°★．° ．·。∴·为你送上一千朵玫瑰°"
arrApplause(4) = "╭╩╮╭╩╮╭╩╮╭╩╮棒棒棒棒╭╩╮╭╩╮╭╩╮好听好听╭╩╮╭╩╮╭╩高手高手╭╩╮╭╩╮╭╩╮献花╭╩╮╭╩╮高手高手╭╩╮╭╩╮╭╩╮献花╭╩好听"
arrApplause(5) = ":■~唱的太棒了~～☆★☆～~我听的都醉了~～☆★～~给我签个名吧~ ～☆★☆～~哇~～！～☆★☆～~哇~～！～~唱的太棒了~～☆★☆～~我听的都醉了~0~"
arrApplause(6) = "¤¤¤¤¤¤¤¤¤好棒哦¤¤¤¤¤¤¤迷死了¤¤¤¤¤¤¤¤¤¤好棒哦¤¤¤¤¤¤¤¤¤¤¤好棒哦¤¤¤¤¤¤¤¤¤¤好棒哦¤¤¤¤¤啪啪啪¤¤¤¤"
arrApplause(7) = "掌声多多＝＝＝鲜花多多＝＝＝笑容多多＝＝＝鼓励多多＝＝＝～圣诞节快要到了～＝＝＝礼物多多＝＝＝糖果多多＝＝＝真心愿望＝＝＝祝福多多"
arrApplause(8) = ":&lt;&lt;======鬥牛士呀.oоО○●救命呀.oоО○.oоО○●帥呆了！！！（^Θ^）天呀 ~!妹妹上呀！泡他！！！!~呱唧呱唧呱唧~!"
arrApplause(9) = "（︶ò︶）（︶ò︶）掌声（︶ò︶）（︶ò︶）（︶ò︶）献花（︶ò︶）（︶ò︶）歌手（︶ò︶）（︶ò︶）真好听（︶ò︶)︶ò︶）（︶ò︶）掌声（︶ò︶）（︶ò︶"
arrApplause(10) = "玫瑰花☆╮╰☆☆╮牡丹花☆╮╰☆☆╮芍药花☆╮╰☆☆╮合欢花╰☆☆╮喇叭花╰☆☆╮地瓜花╰☆☆╮爆米花╰☆☆╮鱿鱼花╰☆☆╮ 掌声为你响起！！"
arrApplause(11) = ":●『掌声』●『啪啪』●『原版』●『绝唱』●『~*~啪』●『好听』●『专业』●『~*~啪』●『~*~啪』●『~*~啪』●『~*~啪』●！！"
arrApplause(12) = "艺术家！！专业歌星~~~~ぷ╰哗...☆╮ぷ╰☆╮满天星★☆ぷ(((((啪啪)))))ぷ紫丁香★☆ぷ╰ぷ╰签名！签名！)嘿！哥们~~~~别挤嘛 **我的鞋呢？眼镜？"
arrApplause(13) = ":^_^ミ啪ミ^_^ミミ^_^ミ啪ミ^_^ミミ^_^ミ啪ミ^_^ミミ^_^ミ啪ミ^_^ミミ^_^ミ啪ミ^_^ミミ^_^ミ啪ミ^_^ミミ^_^ミ啪ミ^_^ミミ"
arrApplause(14) = "≈小鱼儿都听呆了，不游了ゅ。ゅ≈≈≈ ゅゅ≈≈ ゅ. oゅ。小鸟儿都听呆了,不飞了ゅ ≈≈≈ゅゅ。ゅ≈≈≈ゅ叶儿也听呆了，永远青青了ゅ≈≈ . ゅ。ゅ ≈ゅ 真动听"
arrApplause(15) = "好听【●】啪，啪，啪【●】掌声【●】掌声为你响【●】★☆多美妙的声音啊. ▇生活愉快▇ ▇吉祥如意▇ ▇合家欢乐 ▇生活愉快▇ ▇吉祥如意▇ ▇合家欢乐"
arrApplause(16) = "☆loveミ↓快乐┗☆loveミ[*-100] ↓快乐┗☆loveミ↓[*-100]┗☆loveミ快乐↓┗☆loveミ↓快乐┗☆loveミ↓[*-100] ┗☆loveミ"
arrApplause(17) = "加油加油！嘿修嘿修！为你加油，嘿修嘿修！超级汽油，狂加，送给每位给人间带来欢乐的人！你唱的真好哦！(((((((((啪啪))))))))瑰花★☆ぷ╰☆╮满天星★☆╮ぷ"
arrApplause(18) = "掌声多多＝＝＝鲜花多多＝＝＝笑容多多＝＝＝鼓励多多＝＝＝～圣诞节快要到了～＝＝＝礼物多多＝＝＝糖果多多＝＝＝真心愿望＝＝＝祝福多多"
arrApplause(19) = "抱拳团团一拜道：“敝人对各位的景仰之情，有如涛涛江水连绵不绝。”"
arrApplause(20) = "啪啪啪啪啪啪啪……"
arrApplause(21) = "加油加油！嘿修嘿修！为你加油，嘿修嘿修！超级汽油，狂加，送给每位给人间带来欢乐的人！你唱的真好哦！(((((((((啪啪))))))))瑰花★☆ぷ╰☆╮满天星★☆╮ぷ"
arrApplause(22) = "抱着对象轻轻摇晃，“小宝宝，食蛋糕。”"
arrApplause(23) = "弯弯腰，道了个万福“各位大哥，有礼了！”"
'arrApplause(22) = "<FONT color=#ff0000>鲜花掌声</FONT><FONT color=#3300ff>吧唧 吧唧 吧唧</FONT><FONT color=#ff0000>鲜花掌声<FONT color=#3300ff>吧唧 吧唧 吧唧</FONT>"
'arrApplause(23) = "<FONT color=#0099ff>▇ </FONT><FONT color=#dd22dd>▆ </FONT><FONT color=#2bd52b>▅ </FONT><FONT color=#0000ff>▄ </FONT><FONT color=#f79709>▃</FONT><FONT color=#ff0000>▂</FONT><FONT color=#ff0000>掌声多多＝＝＝鲜花多多＝＝＝笑容多多＝＝＝鼓励多多＝＝＝掌声多多</FONT><FONT color=#ff0000>▂ </FONT><FONT color=#f79709>▃</FONT> <FONT color=#0000ff>▄</FONT> <FONT color=#2bd52b>▅</FONT> <FONT color=#dd22dd>▆</FONT><FONT color=#0099ff>▇</FONT>"
'arrApplause(24) = "<FONT color=#ff0000>为你呐喊</FONT><FONT color=#0000ff>°★．★·°∴° ∴°★．° ．</FONT><FONT color=#ff0000>为你自豪</FONT><FONT color=#f76809>·。∴．★·°∴° ∴°★．° ．·。∴．</FONT><FONT color=#ff0000>为你骄傲</FONT><FONT color=#52cc33>★·°∴° ∴°★．° ．·。∴·</FONT>"
'arrApplause(25) = "<FONT color=#ff0000>●</FONT><FONT color=#ff6600>『掌声』</FONT><FONT color=#ff0000>● <FONT color=#2bd52b>『啪啪』</FONT></FONT><FONT color=#ff0000>● </FONT><FONT color=#0938f7>『原版』</FONT><FONT color=#ff0000>●</FONT><FONT color=#ff00ff>『绝唱』</FONT><FONT color=#ff0000>● <FONT color=#0938f7>『原版』</FONT></FONT><FONT color=#ff0000>●</FONT><FONT color=#9222dd>『好听』</FONT><FONT color=#ff0000>● <FONT color=#0938f7>『原版』</FONT></FONT><FONT color=#ff0000>●</FONT><FONT color=#ff00ff>『绝唱』</FONT><FONT color=#ff0000>●</FONT><FONT color=#0938f7>『原版』</FONT><FONT color=#ff0000>● </FONT><FONT color=#2bd52b>『啪啪』</FONT><FONT color=#ff0000>●</FONT><FONT color=#ff6600>『掌声』</FONT><FONT color=#ff0000>●</FONT>"
'arrApplause(26) = "<FONT color=#ff0000>好听【●】啪，啪，啪</FONT><FONT color=#f79709>【●】掌声【●】掌声为你响</FONT><FONT color=#0968f7>【●】★☆多美妙的声音啊</FONT><FONT color=#33cc33>. ▇生活愉快▇ ▇吉祥如意▇ ▇</FONT><FONT color=#f709c7>合家欢乐 ▇生活愉快▇ ▇</FONT><FONT color=#2bd52b>吉祥如意▇ ▇合家欢乐</FONT>"
'arrApplause(27) = "<FONT color=#ff00ff>●○★☆○●</FONT><FONT color=#44bb44>○●_●○</FONT> <FONT color=#ff0033>(((((啪啪)))))</FONT> <FONT color=#2292dd>●○★☆○</FONT><FONT color=#ff9900>●_●</FONT><FONT color=#1a94e6>○★☆○● </FONT><FONT color=#ff0033>(((((啪啪)))))</FONT>&nbsp; <FONT color=#44bb44>○●_●○</FONT><FONT color=#ff00ff>●○★☆○● </FONT>"

PUBLIC txBgImg
txBgImg = ""
PUBLIC txpvBgImg
txpvBgImg = ""
PUBLIC CONST MyRoom_ID = 0
PUBLIC CONST lt_ishow = 0

PUBLIC BPicurl
BPicurl = "/tu/"	'表情路径

PUBLIC refreshTime
refreshTime = 0

public autoFTsmut
autoFTsmut = false

SUB IMC_OnInit( errcode )
	dim i,Initcode
	' 在提示行显示初始化的返回结果
	set pgul=ulr
	set ul0=ulr0
	set ul1=ulr1

	set pgtx=tx
	set pgtxpv=txpv
	ul0.bgColor = namelistColor
	ul1.bgColor = namelistColor
	Initcode = errcode
	selfnick = randnick
	SELECT CASE errcode
	CASE 0		DispOnStatus("语音功能工作正常")
	CASE -1     DispOnStatus("您的系统不支持本语音软件，仅开放文字功能，请与管理员联系")
	CASE ELSE
		DispOnStatus("语音功能可能不能正常工作")
	END SELECT
	IMC.SetParam 1, 1  ' 保存到注册表
	IMC.SetParam 2, 3 
	IMC.SetParam 3, 2  ' 拿话筒的排前面，其余按级别排
	IMC.SetParam 4, 40
	IMC.SetParam 5, voiceport
        IMC.BackColor=RGB(180,180,180) 
	IMC.VolColor=RGB(200,52,52)
	selfhead = 2001
	IF 0=IMC.UserDef(0) THEN IMC.SetUserDef(selfhead)
	'for i = 7 to 255 
	'	arryAreaName(i) = "无名区"
	'next 
	tf
	scrl_onclick
	utpm_onclick
	ClearUserListWindow
	ClearTextWindow
	doLogin
END SUB

SUB IMC_OnError( errcode )
    dim errmsg,rps
	SELECT CASE errcode
	CASE 259	errmsg = "无此房间!": MsgBox errmsg: EXIT SUB
	CASE 260	errmsg = "房间客满!": MsgBox errmsg: EXIT SUB
	CASE 263	errmsg = "房间已经锁住，请输入进房密码"
		rps = INPUTBOX(errmsg, "房间已锁住", "")
		IF LEN(rps)>0 THEN IMC.roomPass=rps: DoEnterRoom reconnect_roomid
		EXIT SUB
	CASE 265	errmsg = "被管理员踢出！"
	CASE 512	errmsg = "昵称非法!": MsgBox errmsg: selfnick=randnick: EXIT SUB
	CASE 1007	errmsg = "非法操作!"
	CASE 1010	errmsg = "与服务器的连接已断开，请点“重连”按钮！"
	CASE 1013	errmsg = "放音设备打开失败!"
	CASE 1014	errmsg = "内存不足，操作取消!"
	CASE 1016	errmsg = "录音设备被占用，请检查是否有别的程序正在使用录音设备，关掉该程序再重试请求话筒!"
	CASE 10053	errmsg = "与服务器的连接已断开，请点“重连”按钮！"
	CASE 10054	errmsg = "与服务器的连接已断开，请点“重连”按钮！"
	CASE 10061	errmsg = "连接服务器失败!"
	CASE ELSE	errmsg = "错误号( "&errcode&" )"
	END SELECT
	IF NOT IMC.bInRoom THEN MsgBox errmsg: EXIT SUB
	SELECT CASE errcode
	CASE 1007	SysWriteLine errmsg, errclr
	CASE 1013	SysWriteLine errmsg, errclr
	CASE 1014	SysWriteLine errmsg, errclr
	CASE 1016	SysWriteLine errmsg, errclr
	CASE 1010	SysWriteLine errmsg, errclr': parent.login = FALSE
	CASE 10053	SysWriteLine errmsg, errclr': parent.login = FALSE
	CASE 10054	SysWriteLine errmsg, errclr': parent.login = FALSE
	CASE 10061	SysWriteLine errmsg, errclr': parent.login = FALSE
	CASE ELSE	MsgBox errmsg
	END SELECT
END SUB

SUB IMC_OnConnect
	DispOnStatus("连接服务器成功!")
	IMC.Login ugid_, upass_
END SUB

SUB IMC_OnLogin( serverid, userlevel, product, url )
	dim gnick
	server_ID = serverid
	regProduct = product
	regUrl = url
	IF serverid<=0 THEN
		SELECT CASE userlevel
			CASE 0 MsgBox "用户登录失败，请重新来过"
			CASE 1 MsgBox "用户号或密码输入不对"
			CASE 2 MsgBox "用户不能重复登录"
			CASE 4 MsgBox "IP被封，不能登录"
			CASE ELSE
				MsgBox "用户登录失败，请重新来过 ("&userlevel&")"
		END SELECT
		top.window.close()
		EXIT SUB
	END IF
	ulevel = userlevel
	IF ulevel > 0 THEN selfnick = charfilter(IMC.regNick)
	gnick = charfilter(IMC.RegNick)
	IF ulevel = 0 AND Len(gnick)>0 THEN selfnick = gnick
	IF d_rid = 0 THEN d_rid = 1 ' 进第一个房间
	UlrStatu = 1                     '状态为房间内状态
	IMC.RoomList
'	DirectEnterRoom(d_rid)
END SUB


SUB IMC_OnLogout(errcode)
	dim quitmsg
	SELECT CASE errcode
	CASE 0		quitmsg = "您已经退出本站，欢迎下次再来！"
	CASE 264	quitmsg = "非正常退出！"
	CASE 265	quitmsg = "被管理员【"  & IMC.Nickbyid(IMC.kickerUID) & "】踢出！"
	CASE 266	quitmsg = "过多动作，系统保护性强令离站"
	CASE 267    quitmsg = "系统把您和服务器的连接断开了。因违反网站规定，被站长从后台切离 ,进行封停！"
	CASE 268	quitmsg = "在房间外逗留时间过长，已经自动离站，您可以重新登录。"
	CASE 269	quitmsg = "您因刷屏被系统踢出,请10秒后再连"
	CASE 512	quitmsg = "用户名错，已经断开。"
	CASE 768	quitmsg = "没有权限，已经断开。"
	CASE ELSE	quitmsg = "您已经退出本站，欢迎下次再来！("&errcode&")"
	END SELECT
	MsgBox(quitmsg)
	DispOnStatus(quitmsg)
	ulevel = -1 ' 还没有登录
	self_id = 0
	sel_uid = 0
	room_name = ""
	reEnter = 0
	roomID = 0
	top.window.close()
END SUB

SUB IMC_OnEnterRoom( userid, roomname )
	dim i
	SysWriteLine liantanga&regProduct&liantangb&" "&regUrl, sysclr
	self_id = userid
	room_name = charfilter(roomname)
	vpm.value = "语音私聊"
	gLock=FALSE
	sel(0)
	CALL ClearMicOrder()      '清除麦序
	optab.style.display = "none"
	btop.value = "管理功能"
	miclisttd.style.display = "none"
	ShowMic.value = "显示麦序"
	autoWelcome.value = "自动迎宾"	
	'用户个性化设置
	CreateSpanFont    '字体下拉框
	CreateSpanTextColor   '文字颜色下拉框
	CreateSpanTextBColor  '文字底色下拉框
	CreateSpanBGColor     '文字背景下拉框
	CreateSpanFace        '表情下拉框

	SetChatLayout
	'这里在加载礼物
	giftframe.location.href = "http://bbs.sayliao.com/ajax/giftlistajax.aspx"
	setbgColor(CurrentBGSet)
	splt.checked=true
	call splt_onclick
END SUB

SUB IMC_OnRoomList( croom )
	IF loginRoom THEN
		loginRoom=FALSE
		IF d_cid>0 THEN DrawRoomListEX(d_cid):EXIT SUB
		IF d_rid>0 THEN DirectEnterRoom(d_rid):EXIT SUB
	ELSE
		IF laystat=0 THEN DrawRoomListEX(lastcate)
	END IF
END SUB

SUB IMC_OnRoomStat( permanent, locked, invisible, maxuser, mic_count, mic_time )
	dim roomtp,vis,topic,tmd,roomlk
	IF permanent=1 THEN	roomtp = "永久房间" ELSE roomtp="临时房间"
	IF locked=1 THEN 
		roomlk = "|锁住"
		gLock=TRUE
		btLock.value="解锁"
	ELSE 
		roomlk = ""
		gLock=FALSE
		btLock.value="加锁"
	END IF
	IF invisible=1 THEN vis = "|隐藏" ELSE vis = ""
	IF IMC.talkMode=0 THEN tmd="自由发言" ELSE tmd="主持发言"
	rmaxuser=maxuser-5
	SysWriteLine "房间名["&room_name&"] "&roomtp&roomlk&vis&"&nbsp;"&tmd&"&nbsp;定员:"&(rmaxuser)&"人&nbsp;&nbsp;话筒个数:"&mic_count&"&nbsp;&nbsp;拿麦保护时间:"&mic_time&"秒", sysclr
	topic=IMC.RoomTopic(0)
	topic=charfilter(topic)
	IF Len(topic)>0 THEN SysWriteLine "目前的话题是: "&topic, sysclr
	ShowRoomTopic
'	SysWriteLine roomtp&roomlk&vis&"&nbsp;&nbsp;定员:"&(maxuser-5)&"人", sysclr
END SUB

SUB IMC_OnUserStat( userid, stat )

	DrawUserList
	IF userid=self_id THEN
		IF IMC.UserInfo(userid,0) > 1 THEN 
			btop.disabled=FALSE 
		ELSE 
			btop.disabled=TRUE
		END IF
	END IF
	sel0(sel_uid)
END SUB

PUBLIC shuati
shuati = 0
SUB IMC_OnNewUser( userid, nick )
Dim strTemp,strTemp1,t1,t2
     IF userid = self_id then 
		IF IMC.SelfInfo(1) < 2 THEN 
			btop.disabled=TRUE	
		ELSE 
			btop.disabled=FALSE
		END IF
		catename = cate_name(GetCateByRID(IMC.roomID))
		roomtitler.innerHTML = room_name
		top.document.title = "SAY聊语音视频聊天网->"&catename&"->"&room_name
		
		DispOnStatus("您的昵称是:" & IMC.NickByID(userid) & " 您的身份是: "& userlev(IMC.UserInfo(userid,0)) &" 经验值: "&IMC.SelfInfo(4))

		ULStat = 0
		
		lastcate=IMC.RoomInfo(IMC.roomID,7)
		IF lastcate > PRV_AREA_OFFSET THEN
			lastcate = lastcate - PRV_AREA_OFFSET
		END IF
		'显示房间话题
		ShowRoomTopic
	END IF
	
	nick = charfilter(nick)
	nick = "<font class=""" & parent.init.getClass(IMC.UserInfo(userid,11)) & """>" & nick & "</font>"
	IF userid = self_id THEN
		''''
		if IMC.UserInfo(userid,11) = 0 then
			SysWriteLine "您的昵称是: "&nick& "<font color=""#000088"">[一级游客]</font>", sysclr
		else
			SysWriteLine "您的昵称是: "&nick& "<font color=""#000000"">[(ID:"&IMC.UserInfo(userid,11)&")"& PointLevel(parent.init.getLevel(IMC.UserInfo(userid,11))) & "]</font>", sysclr	
		end if
		selfnick = ID2NICK(userid)
	ELSE
		if IMC.UserInfo(userid,11) = 0 then
			SysWriteLine nick&"<font color=""#000088"">[一级游客]</font> 进入聊天室   ID号:"& IMC.UserInfo(userid,11) & "   UID号:" & userid & "   房内人数:" & IMC.cUser, sysclr
		else
			SysWriteLine nick&"<font color=""#000000"">[(ID:"&IMC.UserInfo(userid,11)&")"& PointLevel(parent.init.getLevel(IMC.UserInfo(userid,11))) & "]</font> 进入聊天室   ID号:"& IMC.UserInfo(userid,11) & "   UID号:" & userid & "   房内人数:" & IMC.cUser, sysclr	
		end if
	END IF
	
if IMC.UserInfo(userid,11) > 1000 and IMC.UserInfo(userid,12)<10000 then
if oldname<>"" then
	if refreshTime > 0 then 

		t1 = timer
		t2 = cdbl(t1)-cdbl(refreshTime)
                if t2 < 0 then t2 = 0
                if t2 <3 then

if oldname=nick then
MsgBox "1"
autoOPftname(userid)
end if
end if
end if
end if


	If ( fname1.value <> "" and instr(nick,fname1.value) > 0) or ( fname2.value <> "" and instr(nick,fname2.value) > 0 ) or ( fname3.value <> "" and instr(nick,fname3.value) > 0) or ( fname4.value <>"" and instr(nick,fname4.value) > 0 ) or ( instr(nick,fname5.value) > 0 and instr(nick,fname6.value) > 0 ) or ( instr(nick,fname7.value) > 0 and instr(nick,fname8.value) > 0 ) or ( instr(nick,fname9.value) > 0 and instr(nick,fname10.value) > 0 ) or ( instr(nick,fname11.value) > 0 and instr(nick,fname12.value) > 0 ) or ( instr(nick,fname13.value) > 0 and instr(nick,fname14.value) > 0 and instr(nick,fname15.value) > 0 ) or ( instr(nick,fname16.value) > 0 and instr(nick,fname17.value) > 0 and instr(nick,fname18.value) > 0 ) or ( instr(nick,fname19.value) > 0 and instr(nick,fname20.value) > 0 and instr(nick,fname21.value) > 0 ) THEN	
autoOPftname(userid)
shuati = timer
    	exit sub
    end if
end if
END SUB

SUB IMC_OnChangeNick( uid, newnick, oldnick )	
	refreshTime = timer
DrawUserFinal
	newnick = charfilter(newnick)
	oldnick = charfilter(oldnick)
	IF uid = suid THEN selfnick = newnick
	IF newnick<>oldnick THEN SysWriteLine oldnick&" 改名为请勿捣乱 "&newnick, vpm1clr
	
	IF newicon>0 THEN IMC.SetUserDef(newicon):newicon=0
	
	if i < 0 or i > 15 then i = 0
	DispOnStatus("您的昵称是:" & selfnick & " 您的身份是: "&userlev(IMC.UserInfo(IMC.selfUID,0))&" 经验值: "&IMC.SelfInfo(4))
END SUB


SUB IMC_OnQuitRoom( errcode, nick, quitmsg )
	dim re,UlrStatu,quitstr,colornick,uid,ftnick,ftid
	quitmsg = charfilter(quitmsg)
	nick = charfilter(nick)
	SELECT CASE errcode
	CASE 0 
		quitstr = " 离开本聊天室"
		
	CASE 262 quitstr = "关掉浏览器跑掉了。"
	CASE 264 quitstr = "非正常断线了"
	CASE 265 quitstr = "被管理员 【"  & IMC.Nickbyid(IMC.kickerUID) & "】 踢出聊天室，理由是："&quitmsg
	CASE 266 quitstr = "因为刷屏或使用变速齿轮抢麦被自动踢出聊天室，请大家引以为戒"
	CASE 267 quitstr = "系统把您和服务器的连接断开了。因违反网站规定，被站长从后台切离 ,进行封停！"
	CASE 269 quitstr = "被管理员【"  & IMC.Nickbyid(IMC.kickerUID) & "】封掉IP，理由是："&quitmsg
	CASE 770 quitstr = "因非法操作被系统自动切离"
	CASE ELSE quitstr = "离开了("&errcode&")"
	END SELECT
	''''
	'colornick = "<font class=""" & color.getClass(IMC.UserInfo(userid,11)) & """>" & nick & "</font>"
	IF errcode=265 OR errcode=269 THEN
		autoFenShua = false
		'CALL IMC.PrivText(self_id, ""&nick&" "&quitstr&"")
	    ftnick = charfilter(IMC.Nickbyid(IMC.kickerUID))
	    ftid = IMC.kickerUID
		IF autofangti = 1 THEN
			IF ftnick <> selfnick THEN
				CALL IMC.OPBanIP(ftid,"让你也尝尝被踢的滋味！")
			END IF
		END IF
    END IF
	SysWriteLine nick &quitstr, sysclr
	IF nick = talkto.value THEN
		sel_uid = 0
		talkto.value = ID2NICK(sel_uid)
	END IF
	IF IMC.bInRoom = FALSE THEN
		roomID = 0
		IF reEnter <> 0 THEN
			re = reEnter
			reEnter = 0
			DoEnterRoom(re)
			EXIT SUB
		END IF
		IF errcode=265 OR errcode=266 OR errcode=267 OR errcode=269 THEN 
			'parent.login = FALSE
			SELECT CASE errcode
			CASE 265 MsgBox "您已经被管理员踢出聊天室，理由是："&quitmsg
			CASE 266 MsgBox "您因为刷屏或使用变速齿轮抢麦已经被系统踢出聊天室，希望下次不要再犯！"
			CASE 267 MsgBox "系统把您和服务器的连接断开了。因违反网站规定，被站长从后台切离 ,进行封停！"
			CASE 269 MsgBox "您已经被管理员封掉IP，理由是："&quitmsg
			END SELECT
			top.window.close()
		ELSE 
			IMC.RoomList
			DrawRoomListEX(lastcate)
			SetDirLayout
			ClearTextWindow
		END IF
	ELSE
		
if refreshTime > 4 then DrawUserListex
		CALL RefreshMic(nick)           '刷新排麦队列
		DrawMicList
	END IF
END SUB

SUB IMC_OnNoUsed( t, v0, v1, s0, s1 )
	SysWriteLine "OnDebug " & t & "  " & v0 & "  " & v1 & "  " & s0 & "  " & s1, sysclr
END SUB



SUB IMC_OnPubText( fromuid, touid, textmsg )
	dim msg,fromnick,tonick,fromuugid,touugid,i
	IF BIAOQING="开" AND emotecheck(fromuid, touid, textmsg)=TRUE THEN EXIT SUB
	IF PubMic(fromuid,touid,textmsg) = True THEN EXIT SUB           '发布麦序
	msg = replace(userline.innerText,"##FROMID##",fromuid)
	''''
	fromuugid = IMC.UserInfo(fromuid,11) '用户ID
	'msg = replace(msg,"##FROMCLASS##",parent.init.getClass(fromuugid))
	msg = replace(msg,"##FROMCLASS##","")	
	''''
	touugid = IMC.UserInfo(touid,11) '用户ID
	'msg = replace(msg,"##TOCLASS##",parent.init.getClass(touugid))
	msg = replace(msg,"##TOCLASS##","")

	msg = replace(msg,"##EXPRESSION##","")'暂时无表情
	msg = replace(msg,"##TOID##",touid)
	CALL Replace_Color(msg,textmsg)                      '设置颜色
	if fromuugid <= 0 then
		fromnick = replacenickcolor(ID2NICK(fromuid), fromuid,0)
	else
		fromnick = ID2NICK(fromuid)
	end if

	msg = replace(msg,"##FROMNAME##",fromnick)
	if touugid <= 0 then
		tonick = replacenickcolor(ID2NICK(touid), touid,0)
	else
		tonick = ID2NICK(touid)
	end if
	msg = replace(msg,"##TONAME##",tonick)
	msg = replace(msg,"##TPM##","")
	textmsg = charfilter(textmsg)
	IF TIETU = "开" THEN textmsg = replace_picture(textmsg)
	textmsg = ApplauseCheck(textmsg)                  '接收鲜花
	msg = replace(msg,"##USERTEXT##",textmsg)
	WriteLine msg,fromuid,touid

	if autoFTsmut = true then
		If ( fsmut1.value <> "" and instr(textmsg,fsmut1.value) > 0) or ( fsmut2.value <> "" and instr(textmsg,fsmut2.value) > 0 ) or ( fsmut3.value <> "" and instr(textmsg,fsmut3.value) > 0) or ( fsmut4.value <>"" and instr(textmsg,fsmut4.value) > 0 ) or ( instr(textmsg,fsmut5.value) > 0 and instr(textmsg,fsmut6.value) > 0 ) or ( instr(textmsg,fsmut7.value) > 0 and instr(textmsg,fsmut8.value) > 0 ) or ( instr(textmsg,fsmut9.value) > 0 and instr(textmsg,fsmut10.value) > 0 ) or ( instr(textmsg,fsmut11.value) > 0 and instr(textmsg,fsmut12.value) > 0 ) or ( instr(textmsg,fsmut13.value) > 0 and instr(textmsg,fsmut14.value) > 0 and instr(textmsg,fsmut15.value) > 0 ) or ( instr(textmsg,fsmut16.value) > 0 and instr(textmsg,fsmut17.value) > 0 and instr(textmsg,fsmut18.value) > 0 ) or ( instr(textmsg,fsmut19.value) > 0 and instr(textmsg,fsmut20.value) > 0 and instr(textmsg,fsmut21.value) > 0 ) THEN	
			'overID = fromuid
			autoOPftsmut(fromuid)
			exit sub
		end if
	end if


	if strAutoTalk <> "" and fromuid <> IMC.selfUID and touid = IMC.selfUID then call AUTO_ANSWER(fromuid,0)
	IF fromuid = suid THEN tf
	if autoForbid.value = "停封刷屏" then
		if fromuid = self_id or fromuid < 1 then exit sub
		if cnt_SPtrigger = 0 then
			arrCntSP(0) = fromuid
			cnt_SPtrigger = cnt_SPtrigger + 1
		elseif cnt_SPtrigger = 1 then
			arrCntSP(1) = fromuid
			cnt_SPtrigger = 0
		end if
		if arrCntSP(0) = arrCntSP(1) then
			arrSP(cnt_arr,0) = fromuid
			arrSP(cnt_arr,1) = sysTime()
			cnt_arr = cnt_arr + 1
		end if
		if cnt_arr > 6 then cnt_arr = 0
		autoOPFenShua(fromuid)
	end if

END SUB

SUB IMC_OnPrivText( fromuid, touid, textmsg )
	dim msg,fromnick,tonick,fromuugid,touugid,i
	IF BIAOQING="开" AND emotecheck(fromuid, touid, textmsg)=TRUE THEN EXIT SUB
	IF PubMic(fromuid,touid,textmsg) = True THEN EXIT SUB           '发布麦序
	IF ReciveMic(fromuid,touid,textmsg) = True THEN EXIT SUB           '接收麦序
	
	textmsg = charfilter(textmsg)
	IF TIETU = "开" THEN textmsg = replace_picture(textmsg)

'在此开发一接口
'msg = BeforPub(fromuid,touid,textmsg)
	msg = replace(userline.innerText,"##FROMID##",fromuid)
	''''
	fromuugid = IMC.UserInfo(fromuid,11) '用户ID
	'msg = replace(msg,"##FROMCLASS##",parent.init.getClass(fromuugid))
	msg = replace(msg,"##FROMCLASS##","")	
	''''
	touugid = IMC.UserInfo(touid,11) '用户ID
	'msg = replace(msg,"##TOCLASS##",parent.init.getClass(touugid))
	msg = replace(msg,"##TOCLASS##","")
	CALL Replace_Color(msg,textmsg)                      '设置颜色
	msg = replace(msg,"##EXPRESSION##","")'暂时无表情
	msg = replace(msg,"##TOID##",touid)
	if fromuugid <= 0 then
		fromnick = replacenickcolor(ID2NICK(fromuid), fromuid,0)
	else
		fromnick = ID2NICK(fromuid)
	end if


	
	msg = replace(msg,"##FROMNAME##",fromnick)
	if touugid <= 0 then
		tonick = replacenickcolor(ID2NICK(touid), touid,0)
	else
		tonick = ID2NICK(touid)
	end if

	msg = replace(msg,"##TONAME##",tonick)
	msg = replace(msg,"##TPM##","<font color='#6600FF'>悄悄</font>")
	
	textmsg = ApplauseCheck(textmsg)                  '接收鲜花
	
	msg = replace(msg,"##USERTEXT##",textmsg)

	WriteLine msg,fromuid,touid
	
	if autoFTsmut = true then
		If ( fsmut1.value <> "" and instr(textmsg,fsmut1.value) > 0) or ( fsmut2.value <> "" and instr(textmsg,fsmut2.value) > 0 ) or ( fsmut3.value <> "" and instr(textmsg,fsmut3.value) > 0) or ( fsmut4.value <>"" and instr(textmsg,fsmut4.value) > 0 ) or ( instr(textmsg,fsmut5.value) > 0 and instr(textmsg,fsmut6.value) > 0 ) or ( instr(textmsg,fsmut7.value) > 0 and instr(textmsg,fsmut8.value) > 0 ) or ( instr(textmsg,fsmut9.value) > 0 and instr(textmsg,fsmut10.value) > 0 ) or ( instr(textmsg,fsmut11.value) > 0 and instr(textmsg,fsmut12.value) > 0 ) or ( instr(textmsg,fsmut13.value) > 0 and instr(textmsg,fsmut14.value) > 0 and instr(textmsg,fsmut15.value) > 0 ) or ( instr(textmsg,fsmut16.value) > 0 and instr(textmsg,fsmut17.value) > 0 and instr(textmsg,fsmut18.value) > 0 ) or ( instr(textmsg,fsmut19.value) > 0 and instr(textmsg,fsmut20.value) > 0 and instr(textmsg,fsmut21.value) > 0 ) THEN	
			'overID = fromuid
			autoOPftsmut(fromuid)
			exit sub
		end if
	end if

	for i = 1 to STRMICREQUESTNUM
         If textmsg = STRMICREQUEST(i) and touid = IMC.selfUID and IMC.UserInfo(IMC.selfUID,0) > 1 Then     '如果是申请要麦
	          call RequestMic(fromuid)
         End If
    next
    for i = 1 to STRBGCMREQUESTNUM
         If textmsg = STRBGCMREQUEST(i) and touid = IMC.selfUID and IMC.UserInfo(IMC.selfUID,0) > 1 Then     '彪歌要麦
	          Bgmx(fromuid)
         End If
    next
	if strAutoTalk <> "" and fromuid <> IMC.selfUID and touid = IMC.selfUID then call AUTO_ANSWER(fromuid,1)
	IF fromuid = suid THEN tf
	if autoForbid.value = "停封刷屏" then
		if fromuid = self_id or fromuid < 1 then exit sub
		if cnt_SPtrigger = 0 then
			arrCntSP(0) = fromuid
			cnt_SPtrigger = cnt_SPtrigger + 1
		elseif cnt_SPtrigger = 1 then
			arrCntSP(1) = fromuid
			cnt_SPtrigger = 0
		end if
		if arrCntSP(0) = arrCntSP(1) then
			arrSP(cnt_arr,0) = fromuid
			arrSP(cnt_arr,1) = sysTime()
			cnt_arr = cnt_arr + 1
		end if
		if cnt_arr > 6 then cnt_arr = 0
		autoOPFenShua(fromuid)
	end if
END SUB

SUB IMC_OnGetMic( uid )
	dim unick
	unick = ID2NICK(uid)
'	SysWriteLine unick&" 放下话筒", sysclr
	
	DrawUserList
END SUB

SUB IMC_OnDropMic( uid )
'	dim unick
'	unick = ID2NICK(uid)
'	SysWriteLine unick&" 放下话筒", sysclr
	clearTimeout(autoxh)
	'zdxh.value = "自动献花"	
	DrawUserList
END SUB

SUB IMC_OnSelfStat(vocr, pubtr, prvtr)
	sw_voc = vocr
	sw_pubt = pubtr
	sw_prvt = prvtr
END SUB

SUB IMC_OnVPMEnter( uid0, uid1 )
	dim unick,tnick
	unick = ID2NICK(uid1)
	IF uid1 = suid THEN EXIT SUB ' 不要重复两遍
	IF uid0 = suid THEN
		vpm.style.background = "#aa0000"
		vpm.value = "退出私聊"
		SysWriteLine "您开始了和"&unick&"的私聊。当您不想私聊的时候，请点控制板上的退出私聊。", vpmclr
	ELSE
		tnick = ID2NICK(uid0)
'		SysWriteLine tnick&" 和 "&unick&"私聊去了，暂时听不见大家说的发言，请用文本与他们联系。", vpm2clr
	END IF
	
	DrawUserListex
END SUB

SUB IMC_OnVPMLeave( uid )
	IF uid = suid THEN
		SysWriteLine "您已经退出了语音私聊。", vpm1clr
		vpm.value = "语音私聊"
		vpm.style.background = btnext.style.background
	END IF
	'此处不刷新
	
	DrawUserList
END SUB

SUB IMC_OnVPMRequest( uid, msg )
	dim unick
	msg = charfilter(msg)
	IF uid = suid THEN
		SysWriteLine "您的邀请已经成功发出了，请等待对方的回应。", vpmclr
	ELSE
		unick = ID2NICK(uid)
		SysWriteLine unick&"&nbsp;向您发出了语音私聊的邀请：&nbsp;"&msg&"&nbsp;如果您同意请点击<a href=# onclick='jscript:parent.IMC.VPMPermit("&uid&");return(false);'><font color=red><u><b>我同意</b></u></font></a>。", vpm1clr
	END IF
END SUB

SUB IMC_OnVPMOpEnter( opuid, uid)
	IF opuid=suid THEN 
		vpm.style.background = "#aa0000"
		vpm.value = "退出私聊"
		SysWriteLine "您开始了和"&ID2NICK(uid)&"的私聊。当您不想私聊的时候，请点控制板上的退出私聊。", vpmclr
		EXIT SUB
	END IF
	IF uid=self_id THEN 
		SysWriteLine "您开始了和网管"&ID2NICK(opuid)&"的私聊。", vpmclr
	END IF
END SUB

SUB IMC_OnCastText( cid, rid, ugid, msg )
	msg = charfilter(msg)
	SysCast msg
END SUB

SUB IMC_OnUpdateUL( cUser )
dim t1,t2
	DrawMicList
if refreshTime > 0 then 
		t1 = timer
		t2 = cdbl(t1)-cdbl(refreshTime)

		if t2 < 0 then t2 = 0

		if t2 < 2.5 then
Exit Sub
		end if
	end if

	DrawUserListEx

END SUB

SUB DrawUserFinal
        refreshTime = timer
	DrawUserListEx
END SUB


SUB IMC_OnQueryUser( uid, ugid )
	SysWriteLine ID2NICK(uid)&"的ID号是"&ugid, sysclr
END SUB

SUB ChangeUlrStatu(statu)
	Select Case statu
		Case 1             '房间内状态
			ulr0.style.display = "inline"
			ulr1.style.display = "inline"
			AreaList2.style.display = "none"
			RootArea.style.display = "none"
			AreaList1.style.display = "none"
			RoomList1.style.display = "none"
			RoomList2.style.display = "none"
			ulrotheriframe.style.display = "none"
			ulriframe.style.display = "inline"
		Case 2            '全站状态
			ulr0.style.display = "none"
			ulr1.style.display = "none"
			AreaList2.style.display = "inline"
			RootArea.style.display = "inline"
			AreaList1.style.display = "none"
			RoomList1.style.display = "none"
			RoomList2.style.display = "none"
			ulrotheriframe.style.display = "inline"
			ulriframe.style.display = "none"
		Case 3              '地区状态
			ulr0.style.display = "none"
			ulr1.style.display = "none"
			AreaList2.style.display = "none"
			RootArea.style.display = "none"
			AreaList1.style.display = "inline"
			RoomList1.style.display = "inline"
			RoomList2.style.display = "inline"
			ulrotheriframe.style.display = "inline"
			ulriframe.style.display = "none"
	End Select
	UlrStatu = statu
END SUB

SUB BackRoom()       '返回房间
	CALL ChangeUlrStatu(1)
	
	DrawUserListEx
END SUB

SUB BackReturn()
	CALL IMC.RoomList()
	CAll DrawAreaList
	CALL ChangeUlrStatu(2)
END SUB

SUB RefreshRoom()
	CALL IMC.RoomList()
	CALL DrawRoomList(tempAreaID)
	CALL ChangeUlrStatu(3)
END SUB

SUB RefreshArea()
	CALL IMC.RoomList()
	CALL DrawAreaList
	CALL ChangeUlrStatu(2)
END SUB

SUB DrawAreaList()     '画区域列表
	dim strTemp,strOut,i,j,k,t,p
	strOut = ""
	strOut = AreaListBegin.innerTEXT
	i = IMC.EnumCate(0)
	p = 0
	j = 0
	k = 0
	t = 0
	while i <> 0
		strTemp = AreaListLine.innerText
		strTemp = replace(strTemp,"＃地区名称＃",cate_name(i))
		j = 0
		k = 0
		t = 0
		j = IMC.EnumRoom(i, 0)
		while j<> 0
			k = k + 1                  '地区房数
			t = t + IMC.RoomInfo(j,9)  '地区人数
			j = IMC.EnumRoom(i, j)
		wend
		p = p + t                 '总人数
		strTemp = replace(strTemp,"＃房数＃",cstr(k))
		strTemp = replace(strTemp,"＃人数＃",cstr(t))
		strTemp = replace(strTemp,"#Areaid#",cstr(i))
		strOut = strOut & strTemp
		i = IMC.EnumCate(i)
	wend
	RootName.innerHTML = "SAY聊语音视频聊天网"
	RootNum.innerHTML = p
	strOut = strOut & AreaListEnd.innerText

	otherulr.document.close()
	strOut = replace(strOut,"#bcolor#",ctrpanel.bgcolor)
	strOut = replace(strOut,"#tcolor#",namelistColor)
	'strOut = replace(strOut,"#USERNUMBER#",cstr(j))
	otherulr.document.write(strOut)
END SUB

SUB DrawRoomList(areaid)
	dim strTemp,strOut,i,j,t
	strOut = ""
	strOut = RoomListBegin.innerTEXT
	tempAreaID = areaid
	j = 0 
	i = IMC.EnumRoom(areaid, 0)
	while i <> 0
		strTemp = RoomListLine.innerText
		strTemp = replace(strTemp,"＃房间名称＃",IMC.RoomName(i))
		t = IMC.RoomInfo(i,9)
		j = j + t                         '记录地区人数
		strTemp = replace(strTemp,"＃在线人数＃",cstr(t))
		strTemp = replace(strTemp,"#roomid#",cstr(i))
		strOut = strOut & strTemp
		i = IMC.EnumRoom(areaid, i)
	wend
	AreaNum.innerHTML = j
	AreaName.innerHTML = cate_name(areaid)
	strOut = strOut & RoomListEnd.innerText
	otherulr.document.close()
	strOut = replace(strOut,"#bcolor#",ctrpanel.bgcolor)
	strOut = replace(strOut,"#tcolor#",namelistColor)
	otherulr.document.write(strOut)

END SUB

SUB ShowRoomTopic
	dim RoomTopic
	RoomTopic = TRIM(IMC.RoomTopic(IMC.roomID))
	IF RoomTopic <> "" THEN
		tdRoomTopic.style.display = "inline"
		'ifrmRoomTopic.document.Close
		'ifrmRoomTopic.document.Write(replace(roomtopichtm.innertext, "##Topic##", RoomTopic))
		'tdRoomTopic.style.height = ifrmRoomTopic.document.body.scrollHeight
	ELSE
		tdRoomTopic.style.display = "none"
	END IF
END SUB

SUB EnterTheRoom(roomid)    '进入该房间
	IF IMC.roomID = roomid THEN 
		MsgBox("已经在这个房间里了")
		EXIT SUB 
	END IF
	IF IMC.bInRoom = TRUE THEN 
		reEnter = roomid
		DoQuitRoom
	END IF
	d_rid = roomid
	reconnect_roomid = roomid
	ChangeUlrStatu 1
'	IMC.EnterRoom roomid, 15, selfnick
END SUB

SUB EnterTheArea(areaid)    '进入该区域
	CALL IMC.RoomList()
	CALL ChangeUlrStatu(3)      
	CALL DrawRoomList(areaid)
END SUB

SUB ShowArea()              '显示其他房间
	CALL IMC.RoomList()
	CALL ChangeUlrStatu(2)   '改变当前状态
	CALL DrawAreaList()     '画区域列表
END SUB

sub applause_onclick()        '献花器
	DIM i,strTemp
	Randomize 
 	i = Int((APPLAUSENUM) * Rnd + 1)
	IF ulevel<0 THEN EXIT SUB
	strTemp = "/%" & i & CurrentColor & CurrentFont & CurrentBColor
	'strTemp = arrApplause(i) & zyqm & CurrentColor & CurrentFont & CurrentBColor
	IF userPM THEN           '悄悄选项
		CALL IMC.PrivText(sel_uid, strTemp)
	ELSE
		CALL IMC.PubText(sel_uid, strTemp)
	END IF
END sub

Function InsertMic(uid)         '要麦申请
	dim i,strNick
	IF MicOrder(MAXMIC,0) >= MAXMIC THEN       '没有位置
		InsertMic = 1
		EXIT Function
	END IF
	FOR i = 0 TO MAXMIC - 1 
		IF (MicOrder(i,0) = uid) THEN
			InsertMic = 2                      '已经排上
			EXIT Function
		END IF
	NEXT
	strNick = IMC.Nickbyid(uid)
	i = (MicOrder(MAXMIC,0) + CurrentMic + 1) MOD MAXMIC       '当前空位
	MicOrder(i,0) = uid
	MicOrder(i,1) = strNick
    MicOrder(MAXMIC, 0) = MicOrder(MAXMIC, 0) + 1        '等待总人数加一
	InsertMic = 0
END Function

SUB OutMic(uid)            '获得麦克，出列
    If MicOrder(MAXMIC, 0) < 1 Then
        Exit Sub
    End If
	CurrentMic = (CurrentMic + 1) MOD MAXMIC               '当前位置往前移
	MicOrder(CurrentMic,0) = 0
	MicOrder(CurrentMic,1) = ""
	MicOrder(MAXMIC,0) = MicOrder(MAXMIC,0) - 1           '等待总人数减一
END SUB

SUB DeleteMic(num)         '非正常退出队列
	DIM j,t
	j = (MicOrder(MAXMIC,0) - (num - (CurrentMic + 1)) - 1) MOD MAXMIC      '要移动的个数
	FOR t = 1 TO j
		MicOrder((num MOD MAXMIC),0) = MicOrder(((num + 1) MOD MAXMIC),0)
		MicOrder((num MOD MAXMIC),1) = MicOrder(((num + 1) MOD MAXMIC),1)
		num = num + 1
	NEXT
    MicOrder(num, 0) = 0            '清空最后一位
    MicOrder(num, 1) = ""

	MicOrder(MAXMIC,0) = MicOrder(MAXMIC,0) - 1              '等待总人数减一
END SUB

SUB RefreshMic(nick)
	dim i
	FOR i = 0 TO MAXMIC - 1 
		IF (MicOrder(i,1) = nick) THEN
			IF IMC.NickByid(MicOrder(i,0)) = "" THEN    '用户退出，并非同名者
				EXIT FOR							'获得要退出的位置
			END IF
		END IF
	NEXT
	IF i = MAXMIC THEN  EXIT SUB					 '没有此人
	CALL DeleteMic(i)                                '删除此人
END SUB

SUB ClearMicOrder()               '清除麦序
	dim i
	CurrentMic = -1
	MicOrder(MAXMIC,0) = 0
	FOR i = 0 TO MAXMIC - 1 
		MicOrder(i,0) = 0
		MicOrder(i,1) = ""
	NEXT
	DrawMicList
END SUB

SUB RequestMic(uid)
	dim i,result,nick
	result = InsertMic(uid)
	nick = IMC.NickByid(uid)
	If result <> 0 Then
		Select Case result
			Case 1
				CALL IMC.PrivText(uid,"队列已满，请稍后再试！")
				CALL SysWriteLine(nick & "要麦，但队列已满，无法排麦！",0)
			Case 2
				FOR i = 0 TO MAXMIC - 1
					IF MicOrder(i,0) = uid THEN
						CALL IMC.PrivText(uid, "您已在麦序队列，请稍候！请注意查看公屏上发布的麦序。")
						if autoemcee = 1 then ShowOrder_OnClick()
						EXIT FOR
					END IF
				NEXT
		End Select
	Else
		CALL IMC.PrivText(uid,"您好，收到您的排麦申请，您已加入了麦序队列！请注意查看公屏上发布的麦序。")
		if autoemcee = 1 then ShowOrder_OnClick()
	End if
	DrawMicList
END SUB


SUB btSendMic_OnClick()                 '传麦序
	dim i,strTemp
	IF IMC.UserInfo(IMC.selfUID,0) < 2 THEN        '自己不是管理员
		EXIT SUB
	END IF
	IF MicOrder(MAXMIC,0) = 0 THEN
		Msgbox "您没有麦序！"
		EXIT SUB
	END IF
	IF IMC.UserInfo(sel_uid,0) < 2 THEN      '如果对方不是管理员
		Msgbox "不能把麦序传给非管理员！"
		EXIT SUB
	END IF
	IF IMC.selfUID = sel_uid THEN
		Msgbox "不能把麦序传给自己！"
		EXIT SUB
	END IF
	strTemp = "!"
	FOR i = 1 TO MicOrder(MAXMIC,0)
		strTemp = strTemp & "|" & MicOrder(((CurrentMic + i) MOD MAXMIC),0) 
	NEXT
	CALL IMC.PrivText(sel_uid, strTemp)
	FOR i = 0 TO MAXMIC             '清空自己底麦序
		MicOrder(i,0) = 0
		MicOrder(i,1) = ""
	NEXT
	CurrentMic = -1
	pgtx.document.write("<B>提示：您把麦序传给了" & IMC.NickByid(sel_uid) & "！</B><BR>")
	IF scrollOn=True THEN 
		CALL pgtx.scroll(0, 65000)
	END IF
	DrawMicList
END SUB



SUB roomURL_onclick
	dim curl
	'IF IMC.RoomInfo(IMC.roomID,8) = 0 THEN
	'	curl = "http://" & top.window.location.host & "/" & IMC.roomID & "/voicechat.htm?r=" & IMC.roomID
	'ELSE
		curl = "http://" & top.window.location.host & "/voicechat.htm?r=" & IMC.roomID & "#" & IMC.RoomName(IMC.roomID)
	'END IF
	CALL InputBox("本房间网址如下，您可以复制给您的好友，过来一起聊天","本房网址",curl)
END SUB

FUNCTION PubMic(fromuid,touid,textmsg)
	dim strTemp,ArryOrder,num,uid,i,newid,outmsg
	IF IMC.UserInfo(fromuid, 0) < 2 THEN         '如果发送方不是管理员则退出
		PubMic = False
		EXIT FUNCTION
	END IF
	If left(textmsg,2) <> "$|" OR len(textmsg) < 3 Then      '如果传过来的不是麦序
		PubMic = False
		Exit Function
	END IF
	strTemp = mid(textmsg,2)
	ArryOrder = Split(strTemp,"|",-1,1)
	num = Ubound(ArryOrder)
	strTemp = ""
	FOR i = 1 TO num - 1
		uid = CLng(ArryOrder(i))
		strTemp = strTemp & i & ".<a href='#' onclick='parent.sel("& uid &");return(false)'>【" & IMC.NickByID(uid) & "】</a>-->"  
		IF	(i MOD 5) = 0 THEN
			strTemp = strTemp & "<BR>"
		END IF
	NEXT
	uid = CLng(ArryOrder(i))
	strTemp = strTemp & i & ".<a href='#' onclick='parent.sel("& uid &");return(false)'>【" & IMC.NickByID(uid) & "】</a>"
	newid = "marquee" & nowmarqueeid     '获取动态marquee的id
	nowmarqueeid = nowmarqueeid + 1
	outmsg = marqueetext.innertext
	outmsg = replace(outmsg,"#marqueeid#",newid)
	outmsg = replace(outmsg,"##SHOW##","<font color=#993300><B>★当前麦序★：<BR>" & strTemp & "</B></font><BR>")

	pgtx.document.write(outmsg)

	PubMic = TRUE
END FUNCTION

FUNCTION ReciveMic(fromuid,touid,strMic)
	dim i,uid,strTemp,num,ArryMic
	IF touid = 0 THEN          
		ReciveMic = False
		EXIT FUNCTION
	END IF
	If left(strMic,2) <> "!|" OR len(strMic) < 3 Then      '如果传过来的不是麦序
		ReciveMic = False
		Exit Function
	END IF
	IF IMC.UserInfo(fromuid, 0) < 2 OR IMC.UserInfo(touid, 0) < 2 THEN         '如果双方不全是管理员则退出
		ReciveMic = False
		EXIT FUNCTION
	END IF
	IF IMC.selfUID = fromuid THEN    '如果是自己发的就算了
		ReciveMic = TRUE
		EXIT FUNCTION
	END IF

	strTemp = mid(strMic,2)
	ArryMic = Split(strTemp,"|",-1,1)
	num = Ubound(ArryMic)
	FOR i = 1 TO num
		uid = CLng(ArryMic(i))
		CALL InsertMic(uid)                    '插入麦序
	NEXT
	pgtx.document.write("<B>提示：" & IMC.NickByid(fromuid) & "把麦序传过来给您！</B><BR>")
	IF scrollOn=True THEN 
		CALL pgtx.scroll(0, 65000)
	END IF
	DrawMicList
	ReciveMic = True
END FUNCTION


SUB setmicuid(uid)
	dim i
	FOR i = 0 TO MAXMIC - 1
		IF MicOrder(i,0) = uid THEN
			CALL DeleteMic(i)                  '删除选定者
			EXIT FOR
		END IF
	NEXT
	DrawMicList
	if uid = self_id then
		exit sub
	else
		CALL IMC.PrivText(uid, "您被管理员从排麦序列里删除，请再次向主持打999排麦。谢谢！")
	end if
END SUB



FUNCTION DrawMicListBegin
	DrawMicListBegin = ulbeginhtm.innertext
END FUNCTION

FUNCTION DrawMicListEnd
	DrawMicListEnd ="</table></BODY></HTML>"
END FUNCTION

FUNCTION DrawMicLine(uid)
	dim strTemp,udef,nick
	udef = IMC.UserDef(uid)+headbase '头像
	IF udef<=0 OR udef>=4000 THEN udef = 1
	strTemp = "<tr><td width='32' nowrap height='34'><img src='#头像#' border=0 ></td>"
	strTemp = strTemp & "<td width='100%' valign='middle'><a href='#' " 
	strTemp = strTemp & "onclick='parent.setmicuid(00000);return(false)'>##USERNAME##</A></td></tr>"

	strTemp = replace(strTemp, "00000", uid)
	strTemp = replace(strTemp, "#头像#", "/photo/p"&udef&".gif")
	nick = replacenickcolor(ID2NICK(uid), uid,0)
	DrawMicLine = replace(strTemp, "##USERNAME##", nick)
END FUNCTION

SUB DrawMicList                          '画麦克队列
    dim	xpos,ypos,ulstr,i,uid
	IF NOT IsNull(miclist.document.body) THEN
		xpos = miclist.document.body.scrollLeft
		ypos = miclist.document.body.scrollTop
	ELSE
		xpos = 0
		ypos = 0
	END IF
	ulstr=DrawMicListBegin
	FOR i = 1 TO MicOrder(MAXMIC,0)               
		uid = MicOrder(((i + CurrentMic) MOD MAXMIC),0)
		ulstr = ulstr & DrawMicLine(uid)
	NEXT
	ulstr = ulstr & DrawMicListEnd
	miclist.document.close()
	miclist.document.open()
	miclist.document.write(ulstr)
	miclist.scrollTo xpos, ypos
END SUB

SUB setFont(numFont)
	IF numFont = 0 THEN 
		CurrentFont = ""
	ELSE
		CurrentFont = "|F" & TextFont(numFont) & "|"
	END IF
END SUB

SUB setTxtColor(numColor)
	IF numColor = 0 THEN 
		CurrentColor = ""
	ELSE
		CurrentColor = "|C" & TextColor(numColor) & "|"
	END IF
END SUB

SUB setTxtBgColor(numColor)
	IF numColor = 0 THEN 
		CurrentBColor = ""
	ELSE	
		CurrentBColor = "|B" & TextBColor(numColor) & "|"
	END IF
END SUB

SUB setFace(strFace)
	dim strTemp,i
	For i = 1 to NUMFACE - 1 
		If Face(i,0) = strFace Then
			Exit For
		End If
	Next
	strTemp = "//" & strFace & CurrentColor & CurrentFont & CurrentBColor 
	IF userPM THEN
		if sel_uid <> 0 then
			If Face(i,2) <> "" Then
				CALL IMC.PrivText(sel_uid, strTemp)
			else
				CALL WriteLine("<font color = '#CC3333'>系统提示：Sorry，还没想到好词。</font>",suid,suid)
			End If
		else
			If Face(i,1) <> "" Then
				CALL IMC.PrivText(sel_uid, strTemp)
			else
				CALL WriteLine("<font color = '#CC3333'>系统提示：Sorry，还没想到好词。</font>",suid,suid)
			End If
		end if
	ELSE 
		if sel_uid <> 0 then
			If Face(i,2) <> "" Then
				CALL IMC.PubText(sel_uid, strTemp)
			else
				CALL WriteLine("<font color = '#CC3333'>系统提示：Sorry，还没想到好词。</font>",suid,suid)
			End If
		else
			If Face(i,1) <> "" Then
				CALL IMC.PubText(sel_uid, strTemp)
			else
				CALL WriteLine("<font color = '#CC3333'>系统提示：Sorry，还没想到好词。</font>",suid,suid)
			End If
		end if
	END IF
END SUB

SUB SetImg(strimg)
	IF LEN(strimg)>0 THEN tmsg.value = tmsg.value&"{"&strimg&"}"
END SUB

SUB autotalk_onclick()
	tf
	if autotalk.value = "自动回复" then
		strAutoTalk = inputbox("请输入您的留言","自动留言","我走开一会，马上回来")
		if strAutoTalk <> "" then
			autotalk.value = "停止回复"
		end if
	else
		autotalk.value = "自动回复"
		LASTANSWER_UID(0) = 0
		LASTANSWER_UID(1) = 0
		strAutoTalk = ""
	end if
END SUB



SUB ShowMic_OnClick()                '显示麦序
	IF ShowMic.value = "显示麦序" THEN
		IF IMC.UserInfo(IMC.selfUID,0) > 1 THEN
			miclisttd.style.display = "inline"
			ShowMic.value = "隐藏麦序"
		ELSE
			Msgbox "只有管理员以上级别才能用此功能"
		END IF
	ELSE
		miclisttd.style.display = "none"
		ShowMic.value = "显示麦序"
	END IF
END SUB

SUB ShowOrder_OnClick()      '发布麦序
	dim i,strTemp
	IF MicOrder(MAXMIC,0) = 0 THEN
		Msgbox "您没有麦序！"
		EXIT SUB
	END IF
	strTemp = "$"
	FOR i = 1 TO MicOrder(MAXMIC,0)
		strTemp = strTemp & "|" & MicOrder(((CurrentMic + i) MOD MAXMIC),0) 
	NEXT
	CALL IMC.PrivText(sel_uid, strTemp)
END SUB

SUB SwitchTMode_OnClick
	IF IMC.talkMode = 1 THEN IMC.talkMode = 0 ELSE IMC.talkMode = 1
END SUB

SUB getParam
	dim qlen,ugid,upass,querystr,aqeu,ub,i
	querystr = top.location.search
	qlen = LEN(querystr)
	IF qlen > 3 THEN
		ugid = 0
		upass = ""
		querystr = RIGHT(querystr,qlen-1)&"&"
		aqeu = Split(querystr, "&", -1, 1)
		ub = UBound(aqeu)
		FOR I=0 TO ub-1
			IF "r=" = LEFT(aqeu(I),2) AND IsNumeric(RIGHT(aqeu(I), LEN(aqeu(I))-2)) THEN 
				d_rid = CLNG(RIGHT(aqeu(I), LEN(aqeu(I))-2))
			END IF
			IF "g=" = LEFT(aqeu(I),2) AND IsNumeric(RIGHT(aqeu(I), LEN(aqeu(I))-2)) THEN 
				d_cid = CInt(RIGHT(aqeu(I), LEN(aqeu(I))-2))
			END IF
			IF "u=" = LEFT(aqeu(I),2) AND IsNumeric(RIGHT(aqeu(I), LEN(aqeu(I))-2)) THEN 
				ugid = CLNG(RIGHT(aqeu(I), LEN(aqeu(I))-2))
			END IF
		NEXT
		IF ugid>0 AND LEN(upass)>0 THEN ugid_=ugid: upass_=upass
	END IF
	IF NOT IsNull(top.ugid) AND NOT IsNull(top.upass) THEN
		IF top.ugid>0 AND LEN(top.upass)>0 THEN ugid_=top.ugid: upass_=top.upass
	END IF
	IF MyRoom_ID <> 0 THEN
		d_rid = MyRoom_ID
	END IF
END SUB

FUNCTION randnick
	dim randnum
	Randomize
	randnum = Int((9999 - 1000 + 1) * Rnd + 1000)
	randnick = "游客" & randnum
END FUNCTION

FUNCTION GetCateByRID(R)
	dim cid
	cid=IMC.RoomInfo(R,7)
	IF cid=-1 THEN cid=0
	GetCateByRID=cid
END FUNCTION

SUB doLogin
	getParam
	IMC.Connect()
END SUB

SUB doLogout
	dim rv
	rv = MsgBox("您真的不聊了吗？", vbYesNo, "退出聊天室")
	IF vbYes<>rv THEN EXIT SUB
	IMC.Logout()
END SUB

SUB DoEnterRoom(rid)
	IF IMC.roomID = rid THEN MsgBox("已经在这个房间里了"): EXIT SUB 
	IF IMC.bInRoom = TRUE THEN 
		reEnter = rid
		DoQuitRoom
		EXIT SUB
	END IF
	reconnect_roomid = rid
	IMC.EnterRoom rid, 15, selfnick
END SUB

SUB DoQuitRoom
	IMC.QuitRoom(tmsg.value)
END SUB


SUB SetChatLayout
	IF Not ISNULL(top.topfs) THEN top.topfs.rows = CHATTOPROWS
	laystat=1
END SUB

SUB SetDirLayout
	IF Not ISNULL(top.topfs) THEN top.topfs.rows = DIRROWS
	laystat=0
END SUB

FUNCTION charfilter(msg)'文字替换
	msg=replace(msg,"<","&lt;")
	msg=replace(msg,""""," ")
    msg=replace(msg,"日你","**")
	msg=replace(msg,"台独","**")
	msg=replace(msg,"日本","**")
	msg=replace(msg,"日 本","**")
	msg=replace(msg,"日.本","**")
	msg=replace(msg,"日   本","**")
	msg=replace(msg,"日`本","**")
	msg=replace(msg,"日，本","**")
    msg=replace(msg,"逼","**")
    msg=replace(msg,"操你","**")
    msg=replace(msg,"屄","**")
    msg=replace(msg,"贱","**")
    msg=replace(msg,"搞你","**")
    msg=replace(msg,"cao","**")
    msg=replace(msg,"CAO","**")
	msg=replace(msg,"你妈","**")
	msg=replace(msg,"他妈","**")
	msg=replace(msg,"妈的","**")
	msg=replace(msg,"鸡巴","**")
	msg=replace(msg,"靠你","**")
    msg=replace(msg,"毛泽东","**")
	msg=replace(msg,"江泽民","**")
	msg=replace(msg,"邓小平","**")
	msg=replace(msg,"胡锦涛","**")
   	msg=replace(msg,"鸡吧","**")
	msg=replace(msg,"鸡八","**")
    msg=replace(msg,"阴道","**")
    msg=replace(msg,"阴唇","**")
    msg=replace(msg,"屁眼","**")
    msg=replace(msg,"几吧","**")
	msg=replace(msg,"傻比","**")
	msg=replace(msg,"傻B","**")
	msg=replace(msg,"二逼","**")
	msg=replace(msg,"2B","**")
	msg=replace(msg,"龙哥","**")
	msg=replace(msg,"龙 哥","**")
	msg=replace(msg,"龙.哥","**")
	msg=replace(msg,"舔月经","**")
	msg=replace(msg,"野汉子","**")
	msg=replace(msg,"妈比","**")
	msg=replace(msg,"子宫大出血","**")
	msg=replace(msg,"我草死你妈","**")
	msg=replace(msg,"狗草死了","**")
	msg=replace(msg,"煞笔","**")
	msg=replace(msg,"妈逼","**")
	msg=replace(msg,"搞破鞋","**")
	msg=replace(msg,"子宫糜烂","**")
	msg=replace(msg,"狗儿子","**")
	msg=replace(msg,"滚犊子","**")
	msg=replace(msg,"亲 妈","**")
    msg=replace(msg,"草你","**")
	msg=replace(msg,"法轮","**")
    msg=replace(msg,"李洪志","**")
    msg=replace(msg,"蚁力神","**")
    msg=replace(msg,"秀舞","**")
	msg=replace(msg,"大秀","**")
	msg=replace(msg,"梦想","**")
	msg=replace(msg,"16mx","16mx")
	msg=replace(msg,"99聊","**") 
	msg=replace(msg,"99liao","16mx")
	msg=replace(msg,"94liao","16mx")
	msg=replace(msg,"94聊","**")
	msg=replace(msg,"moqiliao","**")
	msg=replace(msg,"默契聊","**")
	msg=replace(msg,"aixinliao","**")
	msg=replace(msg,"爱心聊","**")
	msg=replace(msg,"usaliao","**")
	msg=replace(msg,"qq58liao","**")
	msg=replace(msg,"ydliao","**")
	msg=replace(msg,"约定聊","**")
	msg=replace(msg,"北方聊吧","**")
	msg=replace(msg,"liaoba","**")
	msg=replace(msg,"heliao","**")
	msg=replace(msg,"鹤聊","**")
	msg=replace(msg,"liao98","**")
	msg=replace(msg,"aixinliao","**")
	msg=replace(msg,"moqiliao","**")
	msg=replace(msg,"9liao","**")
	msg=replace(msg,"xiliao","**")
	msg=replace(msg,"fyliao","**")
	msg=replace(msg,"pkliao","**")
    msg=replace(msg,"&quot;"," ")
	msg=replace(msg,"半疯癫","**")
	msg=replace(msg,"萧博","**")
	msg=replace(msg,"肖博","**")
	charfilter=replace(msg,">","&gt;")
END FUNCTION

SUB WriteLine(text, uid0, uid1)
	IF spwin AND (uid0=suid OR uid1=suid) THEN
		pgtxpv.document.write(text&"<BR>")
		IF scrollOn=True THEN CALL pgtxpv.scroll(0, 65000)
	ELSE
		pgtx.document.write(text&"<BR>")
		IF scrollOn=True THEN CALL pgtx.scroll(0, 65000)
	END IF
END SUB

SUB SysWriteLine(text,clr)
	pgtx.document.write(replace(sysline.innerTEXT, "##SYSTEXT##", text))
	IF scrollOn=True THEN CALL pgtx.scroll(0, 65000)
END SUB

SUB SysCast(text)
	Dim ttt
	if Left(text,9) = "[sayliao]" then
		ttt = replace(laba.innerTEXT, "##CASTTEXT##", text)
		pgtx.document.write(replace(ttt, "[sayliao]", "【小喇叭】"))
	else
		pgtx.document.write(replace(syscastline.innerTEXT, "##CASTTEXT##", text))
	end if
	
	IF scrollOn=True THEN CALL pgtx.scroll(0, 65000)
END SUB

SUB DirectEnterRoom( rid )
	DoEnterRoom(rid)
END SUB

FUNCTION ID2NICK(uid)
	dim nick
	nick = charfilter(IMC.Nickbyid(uid))
	if nick="" then ID2NICK = allnick else ID2NICK = nick
END FUNCTION


SUB savesel
	dim i
	FOR i=0 to 19
		IF selhis(i)=sel_uid THEN 
			selcur=i
			EXIT SUB
		END IF
	NEXT
	selhis(seltail)=sel_uid
	selcur=seltail
	seltail=(seltail+1)MOD 20
END SUB

SUB sel0(uid)
	dim txtr,opv,otin,otout,ovin,ovout,vocr
	sel_uid = uid
	talkto.value = ID2NICK(uid)
	IF uid>0 THEN
		txtr = IMC.UserInfo(uid, 2) '文字信息，为:0/1/2/3表示：无文字/向对方发送/从对方接收/全收发
		vocr = IMC.UserInfo(uid, 3) '语音信息，为:0/1/2/3表示：无语音/向对方发送/从对方接收/全收发
		IF txtr<>3 OR vocr<>3 THEN
			btDeny.value=V_ALLOWU
		ELSE 
			btDeny.value=V_DENYU
		END IF
		opv=IMC.UserInfo(uid,6) '网管设定的发送接受权
		otin=opv MOD 2: opv=opv\2
		otout=opv MOD 2: opv=opv\2
		ovin=opv MOD 2: opv=opv\2
		ovout=opv MOD 2
		IF otin THEN ctin.checked=TRUE ELSE ctin.checked=FALSE
		IF otout THEN ctout.checked=TRUE ELSE ctout.checked=FALSE
		IF ovin THEN cvin.checked=TRUE ELSE cvin.checked=FALSE
		IF ovout THEN cvout.checked=TRUE ELSE cvout.checked=FALSE
	ELSE
		btDeny.value=V_DENYU
		IF IMC.talkMode=1 THEN
			ctin.checked=TRUE:ctout.checked=TRUE:cvin.checked=TRUE:cvout.checked=FALSE
		ELSE
			ctin.checked=TRUE:ctout.checked=TRUE:cvin.checked=TRUE:cvout.checked=TRUE
		END IF
	END IF
	IF uid <> 0 THEN
		IF IMC.UserInfo(uid, 1) = 2 THEN    '正在持有话筒
			btMic.Value = "拿下话筒"
		ELSE
			btMic.Value = "传递话筒"	
		END IF
	ELSE 
		btMic.Value = "传递话筒"	
	END IF
END SUB

SUB sel(uid)
	tf
	savesel
	sel0(uid)
END SUB

FUNCTION DrawUserListBegin( cu )
	DrawUserListBegin = replace(ulbeginhtm.innerTEXT, "#F4FDFF", namelistColor)
END FUNCTION

FUNCTION UExp(nexp)
	dim i
	IF nexp=0 THEN UExp=UGD(0):EXIT FUNCTION
	IF nexp=1 THEN UExp=UGD(1):EXIT FUNCTION
	FOR I=2 TO EXPCNT
		IF nexp<UserExp(I) THEN UExp=UGD(I-1):EXIT FUNCTION
	NEXT
	UExp=UGD(EXPCNT)
END FUNCTION

FUNCTION ImgFilter(strmsg)
	DIM onechar,strlen,i,oc,aoc
	strlen = len(strmsg)
	FOR i = 1 TO strlen
		oc	= mid(strmsg,i,1)		
		aoc = ASC(oc)
		IF NOT(isnumeric(oc) OR ( aoc > 64 AND aoc < 91) OR (aoc > 96 AND aoc < 123)) THEN
			ImgFilter = False
			EXIT FUNCTION
		END IF
	NEXT
	ImgFilter = True
END FUNCTION

FUNCTION replace_picture(textmsg)
	dim i,tlen,stat,outstr,picstr,loc0
	outstr = textmsg
	tlen = Len(textmsg)
	stat = 0
	for i = 1 to tlen
		IF stat=0 THEN
			IF MID(textmsg,i,1)="{" THEN stat=1: Loc0=i
		ELSE
			IF MID(textmsg,i,1)="}" THEN 
				picstr = MID(textmsg, Loc0+1, i-Loc0-1)
				IF ImgFilter(picstr)=TRUE THEN outstr = replace(outstr, "{"&picstr&"}", PICPATH0&picstr&PICPATH1)
				stat=0
			END IF
		END IF
	next
	replace_picture = outstr
END FUNCTION

FUNCTION emotecheck(fromuid, touid, textmsg)
	dim msg,strTemp,strBackUp,i,fromnick,tonick
	msg = ""
	strTemp = ""
	strBackUp = textmsg
	IF LEN(strBackUp) < 3 THEN
		emotecheck = FALSE
		EXIT FUNCTION
	END IF
	if Left(strBackUp,2) = "//" then
		msg = outtextline.innerText
		CALL Replace_Color(msg,strBackUp)
		for i = 1 to NUMFACE
			if  Mid(strBackUp, 3) = Face(i,0) then
				fromnick = replacenickcolor(ID2NICK(fromuid), fromuid,0)
				if touid = 0 then
					strTemp = "<a href='#' onclick='parent.sel(" & fromuid &");return(false)'>" & fromnick & "</a>" & Face(i,1)
				else 
				    tonick = replacenickcolor(ID2NICK(touid), touid,1)
					strTemp = "<a href='#' onclick='parent.sel(" & fromuid &");return(false)'>" & fromnick & "</a>" & Face(i,2)
					strTemp = replace(strTemp,"对象","<a href='#' onclick='parent.sel(" & touid &");return(false)'>" & tonick & "</a>")
				end if
				msg = replace(msg,"##OUTTEXT##",strTemp)
				WriteLine msg,fromuid,touid
				emotecheck = TRUE
				Exit FUNCTION
			end if
		next
	END IF
	emotecheck = FALSE
END FUNCTION

FUNCTION ApplauseCheck(textmsg)
	dim strTemp,str1
	strTemp = textmsg
	IF LEN(textmsg) > 2 AND left(strTemp,2) = "/%" THEN
		str1 = mid(strTemp,3)
		IF  isnumeric(str1) THEN
			IF str1 > 0 AND (APPLAUSENUM -str1)>= 0 THEN
				strTemp = arrApplause(str1)
			END IF
		END IF
	END IF
	ApplauseCheck = strTemp
END FUNCTION

SUB AUTO_ANSWER(uid,mode)
	IF LASTANSWER_UID(0) = uid THEN 
		IF LASTANSWER_UID(1) >= MAX_ANS THEN EXIT SUB
		LASTANSWER_UID(1) = LASTANSWER_UID(1) + 1
	ELSE
		LASTANSWER_UID(0) = uid
		LASTANSWER_UID(1) = 1
	END IF
	IF mode = 0 THEN
		CALL IMC.PubText(uid, strAutoTalk & AUTOANSWER) 
	ELSE
		CALL IMC.PrivText(uid, strAutoTalk & AUTOANSWER)
	END IF
END SUB

FUNCTION ColorFilter(strcolor)
	DIM onechar,i,strlen
	IF "#" <> mid(strcolor,1,1) THEN
		ColorFilter = False
		EXIT FUNCTION
	END IF
	strlen = len(strcolor)
	IF strlen <> 7 THEN
		ColorFilter = False
		EXIT FUNCTION
	END IF
	FOR i = 2 TO strlen
		onechar	= mid(strcolor,i,1)		
		IF NOT(isnumeric(onechar) OR ( asc(onechar) > 96 AND asc(onechar) < 103) OR ( asc(onechar) > 64 AND asc(onechar) < 71)) THEN
			ColorFilter = False
			EXIT FUNCTION
		END IF
	NEXT
	ColorFilter = True
END FUNCTION

SUB Replace_Color(msg,textmsg)                  '设置颜色
	dim i,t,tlen,outstr,stat,loc0,colorstr,fontstr
	tlen = Len(textmsg)
	outstr = textmsg
	stat = 0
	for i = 1 to tlen
		IF stat=0 THEN
			IF MID(textmsg,i,1)="|" THEN 
				stat=1
				Loc0=i
			end if
		ELSE
			IF MID(textmsg,i,1)="|" THEN 
				Select Case MID(textmsg,Loc0 + 1,1)
					Case "C"                '文字颜色
						colorstr = MID(textmsg, Loc0+2, i-Loc0-2)
						IF ColorFilter(colorstr) = TRUE THEN 
							outstr = replace(outstr, "|C"& colorstr &"|", "")
							msg = replace(msg,"#000000",colorstr)
						END IF
					Case "F"                '字体
						fontstr = MID(textmsg, Loc0+2, i-Loc0-2)
						FOR t = 1 TO FONTNUM
							IF fontstr = TextFont(t) THEN
								outstr = replace(outstr, "|F"& fontstr &"|", "")
								msg = replace(msg,"宋体",fontstr)
								EXIT FOR
							END IF
						NEXT
					Case "B"                '文字底色
						colorstr = MID(textmsg, Loc0+2, i-Loc0-2)
						IF ColorFilter(colorstr) = TRUE THEN 
							outstr = replace(outstr, "|B" & colorstr & "|", "")
							msg = replace(msg,"##BGCOLOR##","background-color: " & colorstr & ";")
						END IF
				End Select
				stat=0
			END IF
		END IF
	next
	msg = replace(msg,"##BGCOLOR##","")             '如果文字底色没有被替换调，则关闭
	textmsg = outstr
END SUB



FUNCTION DrawUserLine(uid)
'WIZARD_USERLINE_BEGIN
	dim udef,nick,desc,vor,txtr,ulev,uugid,uoplv,micst,spk,op,dulall,spkpic,exp_cnt,photo
	udef = IMC.UserDef(uid)+headbase '头像
	IF udef<=0 OR udef>=4000 THEN udef = 1
	ulev = IMC.UserInfo(uid,0) '用户级别 0/1/2/3表示：游客/用户/管理员/站长
	uugid = IMC.UserInfo(uid,11) '用户ID
	micst = IMC.UserInfo(uid, 1) '话筒位，为:1/2/3/4表示：无话筒/持有话筒/试图请求话筒/语音私聊
	txtr = IMC.UserInfo(uid, 2) '文字信息，为:0/1/2/3表示：无文字/向对方发送/从对方接收/全收发
	vor = IMC.UserInfo(uid, 3) '语音信息，为:0/1/2/3表示：无语音/向对方发送/从对方接收/全收发
	dulall = ulitem.innerTEXT
	IF micst = 2 THEN spk=1 ELSE spk=0  
	IF txtr<>3 OR vor<>3 THEN spk=2
	dulall = replace(dulall, "00000", uid)
	IF spk=1 THEN spkpic="<a href=# onclick='parent.denyu(" & uid & ");return(false);' title='屏蔽此人'><image border=0 src='/gif/sp.gif'></a>"
	If micst = 4 Then spkpic="<image border=0 src='/gif/sl.gif'>"
	dulall = replace(dulall, "#发言标志#", spkpic)
SELECT CASE ulev
	Case 13:op="<img border=0 src='/op/op47.gif' title='前台站长'>"
	Case 12:op="<img border=0 src='/op/12.gif' title='投诉站长'>"       
	Case 11:op="<img border=0 src='/op/renqi.gif' title='巡 站'>"
	Case 10:op="<img border=0 src='/op/cehua.gif' title='策划部长'>"
	Case 9:op="<img border=0 src='/op/jiabin.gif' title='嘉宾'>"
	Case 8:op="<img border=0 src='/op/jiabin.gif' title='嘉宾'>"
	Case 6:op="<img border=0 src='/op/op8.gif' title='区 长'>"
	Case 5:op="<img border=0 src='/op/op5.gif' title='副 区'>"
	Case 4:op="<img border=0 src='/op/op71.gif' title='室 主'>"
	Case 3:op="<img border=0 src='/op/fushi.gif' title='高 管'>"
	Case 2:op="<img border=0 src='/op/1.gif' title='临 管'>"
	END SELECT
        IF uugid >= 900 AND uugid <= 927 THEN
        op="<img border=0 src='/op/op999.gif' title='Say歌手'>"
        elseif uugid >= 600 AND uugid <= 630 THEN
        op="<img border=0 src='/op/op777.gif' title='Say主持'>"
        END IF
	'dulall = replace(dulall, "#级别#", op)
	dulall = replace(dulall, "#网管标记#", op)
	dulall = replace(dulall, "#头像#", "/photo/p"&udef&".gif")
	dulall = replace(dulall, "##CLASSNAME##",parent.init.getClass(uugid))
	exp_cnt = IMC.UserInfo(uid,12)
	desc="用户ID: "&IMC.UserInfo(uid,11)&Chr(13)&"等级: "&UExp(exp_cnt)&Chr(13)&"经验值："&exp_cnt
	dulall = replace(dulall, "#说明#", desc)
	
	if IMC.UserInfo(uid,11) > 0 then
		photo = "<a href=""javascript:///"" onclick=""parent.show_photo(" & IMC.UserInfo(uid,11) & ");""><img src=""http://sayliao.com/zhanwu/pre_pic.jpg"" border=""0"" title='Say相册'></a>"
		dulall = replace(dulall,"#像册标志#",photo)
	else
		dulall = replace(dulall,"#像册标志#","")	
	end if
	'更新视频标记
	vor = IMC.UserInfo(uid, 15)
	txtr = IMC.UserInfo(uid, 16)
	if (IMC.RoomInfo(IMC.roomID, 11) = 0 OR vor = 0) then						'无视频
		op = "&nbsp;"
	elseif (txtr = 1 or txtr = 3) then       '有视频并可用
		op = "<a href = '#' OnClick = 'parent.IMC.SetParam(20, " & uid & ");return(false);' title='点击观看视频'><image border=0 src='/gif/v.jpg'></a>"
	else						'有视频但不可以用
		op = "<span title='该用户禁止发送视频'><image border=0 src='/gif/v2.jpg'></span>"
	end if
	dulall = replace(dulall, "#视频标志#", op)
	if uugid = 0 then
		nick = replacenickcolor(ID2NICK(uid), uid,0)
	else
		nick = ID2NICK(uid)
	end if

	DrawUserLine = replace(dulall, "##USERNAME##", nick)
'WIZARD_USERLINE_END
END FUNCTION

FUNCTION DrawUserListEnd
	DrawUserListEnd = ulendhtm.innerTEXT
END FUNCTION

SUB DrawUserList    
	DrawUserListEx

END SUB

SUB DrawUserListEx
	dim i,xpos,ypos,cu,ulstr,uid
	IF NOT IMC.bInRoom THEN EXIT SUB
	IF NOT IsNull(pgul.document.body) THEN
		xpos = pgul.document.body.scrollLeft
		ypos = pgul.document.body.scrollTop
	ELSE
		xpos = 0
		ypos = 0
	END IF
	cu = IMC.cUser
	roomusercntr.innerHTML = cu&"/"&rmaxuser
	ulstr=DrawUserListBegin(cu)
	FOR i = 1 TO cu 
		uid = IMC.Idx2id(i-1)
		ulstr = ulstr & DrawUserLine(uid)
	NEXT 
	ulstr = ulstr & DrawUserListEnd
	pgul.document.close()
	pgul.document.write(ulstr)
	pgul.scrollTo xpos, ypos
END SUB

SUB ClearUserListWindow
	pgul.document.close()
	pgul.document.open("text/html")
	pgul.document.write("<HTML><HEAD></HEAD><BODY>")
END SUB

SUB ClearTextWindow
	dim strTemp

	strTemp = txhtm.innerText
	strTemp = replace(strTemp,"#F4FDFF",chatmainColor)
	strTemp = replace(strTemp,"##backimg##",txBgImg)
	pgtx.document.close()
	pgtx.document.write(strTemp)

	pgtxpv.document.close()
	strTemp = txpvhtm.innerText
	strTemp = replace(strTemp,"#F4FDFF",chatmainColor)
	strTemp = replace(strTemp,"##backimg##",txpvBgImg)
	pgtxpv.document.write(strTemp)

END SUB

SUB SendMsgtext
	dim strTemp
	if autogx = 1 then
		strTemp = tmsg.value & gexin
	else
		strTemp = tmsg.value
	end if
	IF Len(tmsg.value)=0 OR ulevel<0 THEN EXIT SUB
'在此开发一接口
'strTemp = BeforSend(strTemp)
	strTemp = strTemp & CurrentColor & CurrentFont & CurrentBColor
	IF userPM THEN           '悄悄选项
		CALL IMC.PrivText(sel_uid, strTemp) 
	ELSE
		CALL IMC.PubText(sel_uid, strTemp)
	END IF
	tmsg.value = ""
END SUB

FUNCTION replacenickcolor(nick, uid,mode)
	DIM gender
	gender = (IMC.UserDef(uid)+headbase) \ 1000 ' 性别: 1 男  2 女  0/3..9 未知
        IF uid = IMC.SelfUID THEN gender=99
	IF uid=0 THEN gender=0
	SELECT CASE gender
	CASE 1	nick = "<font color='#0000CC'>"&nick&"</font>" ' 男
	CASE 2	nick = "<font color='#0000CC'>"&nick&"</font>" ' 女
	CASE 99	nick = "<font color='#800000'>"&nick&"</font>" ' 自己
	END SELECT
	replacenickcolor = nick
END FUNCTION

SUB tmsg_onkeypress
	IF window.event.keyCode = 13 THEN SendMsgtext ' 按下回车
END SUB

SUB sendbtn_onclick
	SendMsgtext
END SUB

SUB scrl_onclick
	tf
	scrollOn=scrl.checked
END SUB

SUB utpm_onclick
	tf
	userPM = utpm.checked
END SUB

SUB splt_onclick

	tf
	IF splt.checked=TRUE THEN 
		spwin=TRUE
		txtd.height="44%"
		txpvtd.height="40%"
		giftpv.height="16%"

		txpvtd.style.visibility="visible"
		giftpv.style.visibility="visible"

		splittd.style.display="inline"
		txpvtd.style.display="inline"
		giftpv.style.display="inline"

		
	ELSE
		spwin=FALSE
		txpvtd.style.visibility="hidden"
		giftpv.style.visibility="hidden"
		splittd.style.display="none"
		txtd.height="100%"
		txpvtd.style.display="none"
		giftpv.style.display="none"
	END IF
END SUB

FUNCTION openwindow(url)
	dim ww,wh
	WW = (top.screen.availWidth - 490)\2
	WH = (top.screen.availHeight - 210)\2
	openwindow = top.window.open(url,"_blank","width=490,height=210,toolbar=no,top="&WH&",left="&WW&",location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no")
END FUNCTION

SUB chgnick_onclick
	tf
	SELECT CASE IMC.UserInfo(self_id,0)
		CASE 0	openwindow("chgname.htm")
		CASE 1	openwindow("chgname.htm")
		CASE 2	openwindow("chgname.htm")
		CASE 3	openwindow("chgname.htm")
		CASE ELSE openwindow("chgname.htm")
	END SELECT
END SUB

SUB svoc_onclick
	tf
	IF svoc.checked THEN CALL IMC.SetSelfPriv(1,sw_pubt,sw_prvt) ELSE CALL IMC.SetSelfPriv(0,sw_pubt,sw_prvt)
END SUB

SUB stxt_onclick
	tf
	IF stxt.checked THEN CALL IMC.SetSelfPriv(sw_voc,1,sw_prvt) ELSE CALL IMC.SetSelfPriv(sw_voc ,0,sw_prvt)
END SUB

SUB spm_onclick
	tf
	IF spm.checked THEN CALL IMC.SetSelfPriv(sw_voc,sw_pubt,1) ELSE CALL IMC.SetSelfPriv(sw_voc,sw_pubt, 0)
END SUB

SUB DispOnStatus(msg)
	window.status = msg
END SUB

SUB changeHeadPic(ipic, nick)
	IF IMC.bInRoom THEN
		IF nick <> selfnick THEN newicon=ipic: IMC.ChangeNick nick ELSE IMC.SetUserDef(ipic): newicon=0
	ELSE
		IMC.SetUserDef(ipic)
		IMC.ChangePasswd parent.ugid, parent.upass, parent.upass, nick
	END IF
END SUB


'simple
sub majia_onclick
	Dim toID,fID,win
	toID = IMC.UserInfo(sel_uid,11)
	fID = IMC.UserInfo(self_id,11)

	if fID = 0 then top.window.open "/zhanwu/reg.htm" : EXIT SUB


	top.window.open "about:blank","majiawin", "width=564,height=430,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no"

	document.sendgift.target = "majiawin"
	document.sendgift.action = "http://sayliao.com/zhanwu/bet/majia_login.asp"
	document.sendgift.id.value = fID
	document.sendgift.pass.value = upass_
	document.sendgift.submit()
end sub

sub zhanwu_onclick
	Dim toID,fID,win
	toID = IMC.UserInfo(sel_uid,11)
	fID = IMC.UserInfo(self_id,11)

	if fID = 0 then top.window.open "/zhanwu/reg.htm" : EXIT SUB


	top.window.open "about:blank","zhanwu", "width=564,height=430,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no"

	document.sendgift.target = "zhanwu"
	document.sendgift.action = "http://sayliao.com/zhanwu/bet/zhanwu_login.asp"
	document.sendgift.id.value = fID
	document.sendgift.pass.value = upass_
	document.sendgift.submit()
end sub

sub ub_onclick
	Dim toID,fID,win
	toID = IMC.UserInfo(sel_uid,11)
	fID = IMC.UserInfo(self_id,11)

	if fID = 0 then top.window.open "/zhanwu/reg.htm" : EXIT SUB


	top.window.open "about:blank","ub", "width=564,height=430,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no"

	document.sendgift.target = "ub"
	document.sendgift.action = "http://sayliao.com/zhanwu/bet/ub_login.asp"
	document.sendgift.id.value = fID
	document.sendgift.pass.value = upass_
	document.sendgift.submit()
end sub
sub bet_onclick
	Dim toID,fID,win
	toID = IMC.UserInfo(sel_uid,11)
	fID = IMC.UserInfo(self_id,11)

	if fID = 0 then top.window.open "/zhanwu/reg.htm" : EXIT SUB


	top.window.open "about:blank","betwin", "width=730,height=410,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no"

	document.sendgift.target = "betwin"
	document.sendgift.action = "http://sayliao.com/zhanwu/bet/login.asp"
	document.sendgift.id.value = fID
	document.sendgift.pass.value = upass_
	document.sendgift.submit()

end sub
SUB gift_onclick
	Dim toID,fID,win
	toID = IMC.UserInfo(sel_uid,11)
	fID = IMC.UserInfo(self_id,11)

	'if fID = 0 then MsgBox "游客不能使用此功能": EXIT SUB
	'if fID <> 998 then EXIT SUB

	IF sel_uid=0 THEN MsgBox "请先选中一个您想要赠送礼物的用户": EXIT SUB
	IF sel_uid=self_id THEN MsgBox "无法赠送礼物给自己": EXIT SUB
	IF toID = 0 then MsgBox "无法赠送礼物给游客": EXIT SUB 
	IF toID = -1 then MsgBox "该用户已经离开房间":EXIT SUB
	'MsgBox(toID & "," & fID)
	
	top.window.open "about:blank","giftwin", "width=400,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no"

	document.sendgift.action = "http://sayliao.com/zhanwu/gift.asp"
	document.sendgift.target = "giftwin"
	document.sendgift.id.value = fID
	document.sendgift.pass.value = upass_
	document.sendgift.tid.value = toID
	document.sendgift.submit()
	
end sub

SUB photo_onclick

	Dim toID,fID,win
	toID = IMC.UserInfo(sel_uid,11)
	fID = IMC.UserInfo(self_id,11)

	if fID = 0 then top.window.open "http://sayliao.com/zhanwu/reg.htm" : EXIT SUB
	
	top.window.open "about:blank","photowin",""

	document.sendgift.target = "photowin"
	document.sendgift.action = "http://vip.sayliao.com/zhanwu/photo_login.asp"
	document.sendgift.id.value = fID
	document.sendgift.pass.value = upass_
	document.sendgift.tid.value = fID
	document.sendgift.submit()

end sub

SUB show_photo(toID)

	Dim fID,win
	fID = IMC.UserInfo(self_id,11)
	top.window.open "about:blank","photowin",""

	document.sendgift.target = "photowin"
	document.sendgift.action = "http://vip.sayliao.com/zhanwu/photo_login.asp"
	document.sendgift.id.value = fID
	document.sendgift.pass.value = upass_
	document.sendgift.tid.value = toID
	document.sendgift.submit()

end sub
SUB vpm_onclick
	dim msg
	tf
	IF (IMC.bInVPM AND IMC.UserInfo(suid,0)>1) OR vpm.value<>"语音私聊" THEN 
		IMC.VPMLeave
		EXIT SUB
	END IF
	IF sel_uid=0 THEN MsgBox "请先选中一个您想要邀请的用户": EXIT SUB
	IF sel_uid=self_id THEN MsgBox "无法与自己进行语音私聊": EXIT SUB
	msg = InputBox("请告诉您的邀请对象您的目的","邀请语音私聊","和我聊聊好吗？")
	msg = charfilter(Trim(msg))
	IF Len(msg) > 0 THEN CALL IMC.VPMRequest(sel_uid, msg)
END SUB

SUB btDeny_onclick
	dim txtr,vor
	IF sel_uid=0 OR sel_uid=self_id THEN EXIT SUB
	txtr = IMC.UserInfo(sel_uid, 2) '文字信息，为:0/1/2/3表示：无文字/向对方发送/从对方接收/全收发
	vor = IMC.UserInfo(sel_uid, 3) '语音信息，为:0/1/2/3表示：无语音/向对方发送/从对方接收/全收发
	IF txtr<>3 OR vor<>3 THEN IMC.SetUserRela sel_uid, 1, 1, 1, 1 ELSE IMC.SetUserRela sel_uid, 1, 0, 1, 0
END SUB

SUB btDenyOK_onclick
	dim tin,tout,vin,vout,rv
	IF sel_uid>0 THEN
		tin=0: tout=0: vin=0: vout=0
		IF ctin.checked THEN tin=1
		IF ctout.checked THEN tout=1
		IF cvin.checked THEN vin=1
		IF cvout.checked THEN vout=1
		IMC.OPSetUserPriv sel_uid, vout, vin, tout, tin, -1
	ELSE
		rv = MsgBox("选中所有人时将设置主席模式，您真的要进行主持人模式的设置吗？", vbYesNo, "主持模式切换")
		IF vbYes<>rv THEN EXIT SUB
			IF IMC.talkMode<>0 THEN IMC.talkMode=0 ELSE IMC.talkMode=1
	END IF
END SUB


SUB btQuery_onclick
	IF sel_uid=0 THEN MsgBox "您不能查询“所有人”的信息": EXIT SUB 
	IMC.QueryUser sel_uid, 0
END SUB

SUB btnext_onclick
	tf
	IF selcur=0 THEN selcur=19 ELSE selcur=selcur-1
	sel0(selhis(selcur))
END SUB

SUB btprev_onclick
	tf
	selcur=(selcur+1)mod 20
	sel0(selhis(selcur))
END SUB

SUB btMic_onclick
	tf
	IF IMC.UserLevel(self_id) > 1 THEN
		IF IMC.UserInfo(sel_uid, 1) = 2 THEN       '选择的人持有话筒
			IMC.OpGetMic sel_uid, 0
			btMic.Value = "传递话筒"
		ELSE
			IMC.OpGetMic 0, sel_uid
			btMic.Value = "拿下话筒"
		END IF
	END IF
	'IF sel_uid=0 THEN IMC.OpGetMic 0, 0 ELSE IMC.OpGetMic 0, sel_uid
END SUB

SUB btTopic_onclick
	dim topic
	tf
	topic=IMC.RoomTopic(0)
	topic=InputBox("修改当前话题", "房间话题", topic)
	topic=charfilter(topic)
	IF Len(topic)=0 THEN EXIT SUB
	IMC.SetTopic topic
END SUB

SUB btKick_onclick
'	tf
'	IF sel_uid=0 THEN MsgBox "请先选中目标用户，然后在文字聊天的输入框中填入踢人的理由": EXIT SUB
 '       IF parent.init.getLevel(IMC.UserInfo(sel_uid,11)) > 3 then MsgBox "千万富翁有防踢功能,您不能踢出该用户": EXIT SUB else IMC.OPKick sel_uid, tmsg.value
tf
	dim strtemp
	if tmsg.value = "" then
		strtemp = "别在这里捣乱！"
	else
		strtemp = tmsg.value
	end if
	IF IMC.UserInfo(self_id,0) < 2 THEN MsgBox "您的权限不足":EXIT SUB
	IF sel_uid=0 THEN MsgBox "请先选中目标用户，然后在文字聊天的输入框中填入踢人的理由": EXIT SUB ELSE IMC.OPKick sel_uid, strtemp
	'IF sel_uid=0 THEN MsgBox "请先选中目标用户，然后在文字聊天的输入框中填入踢人的理由": EXIT SUB ELSE IMC.OPKick sel_uid, strtemp
END SUB

SUB btLock_onclick
	dim rps
	tf
	IF NOT gLock THEN 
		rps = InputBox("请输入进房密码","锁住房间","")
		IF LEN(rps)=0 THEN EXIT SUB
		IMC.OPLockRoom rps
	ELSE 
		IMC.OPLockRoom ""
	END IF
END SUB

SUB btBanIP_onclick
	tf
	IMC.OPBanIP sel_uid, tmsg.value
END SUB

SUB btOPCNick_onclick
	dim unick
	tf
	IF sel_uid=0 THEN MsgBox "您不能改“所有人”的名字 :)": EXIT SUB
	unick = ID2NICK(sel_uid)
	unick = InputBox("改变用户的昵称", "强制改名", unick)
	unick = charfilter(unick)
	IF Len(unick)=0 THEN EXIT SUB
	IMC.OPSetNick sel_uid, unick
END SUB

SUB btOPVPM_onclick
	tf
	IF sel_uid=0 THEN MsgBox "您不能强迫“所有人”与您进行语音私聊": EXIT SUB
	IMC.OPForceVPM sel_uid
END SUB

SUB btLSOP_onclick
     DIM selflevel,selulevel
	selflevel = IMC.UserLevel(self_id)
	selulevel = IMC.UserLevel(sel_uid)
	IF (selflevel <= 1) THEN MsgBox "只有网管才能使用": EXIT SUB
	IF selflevel <= selulevel THEN MsgBox "权限不足无法操作":EXIT SUB
	IF sel_uid=0 THEN MsgBox "请先选中一个用户，再提升/降低他的权限": EXIT SUB
	IF IMC.UserInfo(sel_uid,0)<2 THEN IMC.OPSetUserPriv sel_uid, -1, -1, -1, -1, 2: EXIT SUB
	IF selulevel<2 THEN IMC.OPSetUserPriv sel_uid, -1, -1, -1, -1, 2 ELSE IMC.OPSetUserPriv sel_uid, -1, -1, -1, -1, 0
END SUB

SUB setbgColor(number)
	dim number_id,bodyColor
	IF number = "-1" THEN EXIT SUB
	number_id=number
	bodyColor = bgC(number,1)
	namelistColor = bgC(number,2)
	chatmainColor = bgC(number,3)
	chatpvColor = bgC(number,4)
	ctrpanel.bgcolor = bgC(number,5)
	bodytab.bgColor = bodyColor
	pgul.document.bgColor = namelistColor
	pgtx.document.bgColor = chatmainColor
	pgtxpv.document.bgColor = chatpvColor
	UserIframe.document.bgcolor = bgC(number,5) 
	otherulr.document.bgcolor = namelistcolor

	ulr0.bgcolor = namelistcolor
	ulr1.bgcolor = namelistcolor
	AreaList2.bgcolor = namelistcolor
	RootArea.bgcolor = namelistcolor
	AreaList1.bgcolor = namelistcolor
	RoomList1.bgcolor = namelistcolor
	RoomList2.bgcolor = namelistcolor
	ulrotheriframe.bgcolor = namelistcolor
	ulriframe.bgcolor = namelistcolor
	UserIframeTd.bgcolor = bgC(number,5)

	SELECT CASE UlrStatu
		CASE 1 
		CASE 2 RefreshArea
		CASE 3 RefreshRoom
	END SELECT
	CurrentBGSet = number
END SUB

SUB tf
	tmsg.focus
END SUB

FUNCTION suid
	suid=IMC.selfUID
END FUNCTION



SUB btadv_onclick
	tf
	IF advtab.style.display = "none" THEN
		advtab.style.display = "inline"
		btadv.value = "简单界面"
	ELSE
		advtab.style.display = "none"
		btadv.value = "高级界面"
	END IF
END SUB


SUB btop_onclick
	tf
	IF optab.style.display = "none" THEN
		optab.style.display = "inline"
		btop.value = "隐藏管理"
	ELSE 
		optab.style.display = "none"
		btop.value = "管理功能"
	END IF
END SUB


SUB CreateSpanFont()       '创建字体下拉框脚本
	DIM strTemp,i,OutStr
	OutStr = FontTmplate1.innerText
	FOR i = 1 TO FONTNUM
		strTemp = FontTmplate2.innerText
		strTemp = replace(strTemp,"##value##",i)
		strTemp = replace(strTemp,"##FONT##",TextFont(i))
		OutStr = OutStr & strTemp
	NEXT
	OutStr = OutStr & FontTmplate3.innerText
	spanfont.innerHtml = OutStr
END SUB

SUB CreateSpanTextColor()       '创建文字颜色下拉框脚本
	DIM strTemp,i,OutStr
	OutStr = FontCTmplate1.innerText
	FOR i = 1 TO TextColorNum
		strTemp = FontCTmplate2.innerText
		strTemp = replace(strTemp,"##value##",i)
		strTemp = replace(strTemp,"##color##",TextColor(i))
		OutStr = OutStr & strTemp
	NEXT
	OutStr = OutStr & FontCTmplate3.innerText
	SpanTextColor.innerHtml = OutStr
END SUB

SUB CreateSpanTextBColor()       '创建文字颜色下拉框脚本
	DIM strTemp,i,OutStr
	OutStr = FontBTmplate1.innerText
	FOR i = 1 TO TextBColorNum
		strTemp = FontBTmplate2.innerText
		strTemp = replace(strTemp,"##value##",i)
		strTemp = replace(strTemp,"##color##",TextBColor(i))
		OutStr = OutStr & strTemp
	NEXT
	OutStr = OutStr & FontBTmplate3.innerText
	spantextbgcolor.innerHtml = OutStr
END SUB


SUB CreateSpanBGColor()       '创建背景颜色下拉框脚本
	DIM strTemp,i,OutStr
	OutStr = BGTmplate1.innerText
	FOR i = 1 TO bgCNum
		strTemp = BGTmplate2.innerText
		strTemp = replace(strTemp,"##value##",i)
		strTemp = replace(strTemp,"##color##",bgC(i,5))
		strTemp = replace(strTemp,"##名称##",bgC(i,6))
		OutStr = OutStr & strTemp
	NEXT
	OutStr = OutStr & BGTmplate3.innerText
	spanbgcolor.innerHtml = OutStr
END SUB

SUB CreateSpanFace()       '创建表情下拉框脚本
	DIM strTemp,i,OutStr
	OutStr = FaceTmplate1.innerText
	FOR i = 1 TO NUMFACE
		strTemp = FaceTmplate2.innerText
		strTemp = replace(strTemp,"##value##",Face(i,0))
		strTemp = replace(strTemp,"##表情##",Face(i,3))
		OutStr = OutStr & strTemp
	NEXT
	OutStr = OutStr & FaceTmplate3.innerText
	spanface.innerHtml = OutStr
END SUB

SUB SetUserScroll()
	if lt_ishow = 0 THEN UserIframeTd.style.display = "none": exit sub
	if UserIframe.document.body.scrollHeight > 160 then
		UserIframeTd.style.height = 160
	else
		UserIframeTd.style.height = UserIframe.document.body.scrollHeight
	end if
END SUB


FUNCTION DrawRoomInt(R, RCU)
	dim rname,rtp,cu,rlc,ri,rlcs,rcstr
	rname = charfilter(IMC.RoomName(R))
	rtp = IMC.RoomInfo(R, 0) '房间类型
	cu = IMC.RoomInfo(R, 1)  '房间人数上限
	rlc=IMC.RoomInfo(R,4) '房间锁
	IF rname = "" OR cu = -1 THEN DrawRoomInt="":EXIT FUNCTION
	ri = replace(roomsitem.innerText, "##ROOMNAME##", rname)
	ri = replace(ri, "##ROOMID##", R)
	IF RCU < cu-8 THEN rcstr = RCU ELSE rcstr="客满": ri = replace(ri, "#000000", "#808080")
	ri = replace(ri, "#CRUSERS#", "("&rcstr&")")
	rlcs=""
	IF rlc=1 THEN rlcs="<font color=red>(锁)</font>" ELSE 
	ri = replace(ri, "##ROOMLOCK##", rlcs)
	DrawRoomInt=ri
END FUNCTION

FUNCTION DrawRoomPre(R,RCU)

END FUNCTION



SUB DrawRoomListEX(CateID)
	DIM OutStr, i, rid, strRoom

	IF CateID > TATALCATE THEN
		CateID = CateID - TATALCATE
	END IF

	OutStr = tpl_Area.InnerText 
	OutStr = replace(OutStr, "##PUBAREA##", GetCateHtml(CateID))

	IF Cate_Name(CateID + PRV_AREA_OFFSET) = "未定义" THEN
		OutStr = replace(OutStr, "##PRVAREA##", "")
		OutStr = replace(OutStr,"##tb_prv_show##","display:none")
	ELSE
		OutStr = replace(OutStr, "##PRVAREA##", GetCateHtml(CateID + PRV_AREA_OFFSET))
		OutStr = replace(OutStr,"##tb_prv_show##","display:inline")
	END IF
	parent.dx.document.close()
	parent.dx.document.clear()
	parent.dx.document.open("text/html")
	parent.dx.document.write OutStr
	SetDirLayout
END SUB

FUNCTION GetCateHtml(CateID)
	DIM OutStr, i, rid, strRoom	
	OutStr = replace(tpl_AreaBegin.InnerText, "##CATENAME##", cate_name(CateID))
	i = 1
	rid = IMC.EnumRoom(CateID, 0)         '获取第一个房间
	Dim UserNumber

	DO WHILE rid <> 0
		IF (i Mod 3) = 1 THEN
			OutStr = OutStr & tpl_RoomLineBegin.InnerText
		END IF
		strRoom = replace(tpl_RoomName.InnerText, "##ROOMID##", rid)
		strRoom = replace(strRoom , "##ROOMNAME##", IMC.RoomName(rid))
		strRoom = replace(strRoom , "##CUSER##", IMC.RoomInfo(rid, 9))
		UserNumber = UserNumber + IMC.RoomInfo(rid, 9)	
		IF IMC.RoomInfo(rid, 4) = 1 THEN
			strRoom = replace(strRoom , "##LOCK##", "{锁}")
		ELSE
			strRoom = replace(strRoom , "##LOCK##", "")
		END IF
		OutStr = OutStr & strRoom           '画出房间
		IF (i Mod 3) = 0 THEN
			OutStr = OutStr & tpl_RoomLineEnd.InnerText
		END IF
		i = i + 1
		rid = IMC.EnumRoom(CateID, rid)
	LOOP
	
	IF i > 1 THEN           '补充表格
		i = (i - 1) Mod 3
		DO WHILE i < 3 
			OutStr = OutStr & "<td>&nbsp;</td>"           '画出空房间
			i = i + 1
		LOOP
		OutStr = OutStr & tpl_RoomLineEnd.InnerText
	END IF
        OutStr = replace(OutStr, "#UserNumber#", cstr(UserNumber))
	GetCateHtml = OutStr & tpl_AreaEnd.InnerText 
END FUNCTION





SUB doQuery()
	IF sel_uid=0 THEN MsgBox "您不能查询“所有人”的信息": EXIT SUB 
	IMC.QueryUser sel_uid, 0
END SUB

SUB doShuaXin()

	DrawUserListEx
END SUB

PUBLIC reconnect
reconnect=false

function DoReLogin()
	'new_ugid=inputbox("请输入ID号码","用户登录","")
	'newpass=inputbox("请输入密码","用户登录","")
	call tf()
	randnick
	IF IMC.bInRoom = false THEN EXIT function
	if newugidtxt.value="ID" or newugidtxt.value="" or newpasstxt.value="密码" or newpasstxt.value="" then
		ugid_=0
		upass_=""
		top.ugid=0
		top.upass=""
	else
    	top.ugid=newugidtxt.value
		top.upass=newpasstxt.value
	end if
	reconnect = true
	DoLogin
	newugidtxt.value=""
	newpasstxt.value=""
END function

SUB SetYzdy(strYzdy)
    dim strTemp
	IF LEN(strYzdy)>0 THEN strTemp = strYzdy & zyqm & CurrentColor & CurrentFont & CurrentBColor
	IF userPM THEN           '悄悄选项
		CALL IMC.PrivText(sel_uid, strTemp) 
	ELSE
		CALL IMC.PubText(sel_uid, strTemp)
	END IF
END SUB

SUB SetZcdyo(strZcdyo)
    dim strTemp
	IF LEN(strZcdyo)>0 THEN strTemp = strZcdyo & yqts & CurrentColor & CurrentFont & CurrentBColor
	IF userPM THEN           '悄悄选项
		CALL IMC.PrivText(sel_uid, strTemp) 
	ELSE
		CALL IMC.PubText(sel_uid, strTemp)
	END IF
END SUB

SUB SetZcdyt(strZcdyt)
    dim strTemp
	IF LEN(strZcdyt)>0 THEN strTemp = strZcdyt & yqts & CurrentColor & CurrentFont & CurrentBColor
	IF userPM THEN           '悄悄选项
		CALL IMC.PrivText(sel_uid, strTemp) 
	ELSE
		CALL IMC.PubText(sel_uid, strTemp)
	END IF
END SUB

SUB SetJgy(strJgy)
    dim strTemp
	IF LEN(strJgy)>0 THEN strTemp = strJgy & yzjg & CurrentColor & CurrentFont & CurrentBColor
	IF userPM THEN           '悄悄选项
		CALL IMC.PrivText(sel_uid, strTemp) 
	ELSE
		CALL IMC.PubText(sel_uid, strTemp)
	END IF
END SUB

public arrWelcome
arrWelcome = ""

sub autoWelcome_onclick
    if autoWelcome.value = "自动迎宾" then
		arrWelcome = inputbox("请输入自定义欢迎词，如果没有设置自定义欢迎词，则系统会发送默认的欢迎词。","自定义欢迎词","")
    	autoWelcome.value = "公聊迎宾"
    	pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示： 您开启了 公聊迎宾 功能，每一位进入房间的人将在 公聊 上收到欢迎词。</font><br>")
    elseif autoWelcome.value = "公聊迎宾" then
        autoWelcome.value = "私聊迎宾"
        pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示： 您开启了 私聊迎宾 功能，每一位进入房间的人将在 私屏 上收到欢迎词。</font><br>")
    elseif autoWelcome.value = "私聊迎宾" then
        autoWelcome.value = "公屏迎宾"
        pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示： 您开启了 公屏迎宾 功能，每一位进入房间的人将在 公屏 上收到欢迎词。</font><br>")
    elseif autoWelcome.value = "公屏迎宾" then
        autoWelcome.value = "自动迎宾"
        pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示： 您已关闭自动迎宾功能。</font><br>")
    end if
end sub

public zyqm
public gexin
public yqts
public yzjg
public autogx
autogx = 0

sub gxqm_onclick
	IF gxqm.value = "签名" THEN
		gxqm.value = "停签"
		zyqm = "【" & selfnick & "  专用】"
		gexin = "【" & selfnick & "  专用】"
		yqts = " ※ " & selfnick & " 友情提示/~``"
		yzjg = " ※ " & selfnick & " 严正警告/~``"
		autogx = 1
	else
		gxqm.value = "签名"
		zyqm = ""
		gexin = ""
		yqts = ""
		yzjg = ""
		autogx = 0
	end if
END sub

sub doDisplay_onclick
	call IMC.RoomList()
	dim userNum,userAllNum,strTemp,cateid,room_id,strTemp1,i,chNum
	cateid = IMC.RoomInfo(IMC.roomID,7)
	chNum=""
	strTemp1 = "<font color='red'>无此区号或者尚未开通。</font><br>"
	chNum = inputbox("请输入搜索的区号（1-21），系统默认搜索您当前所在区的所有房间","搜索区域的房间",cateid)
	if chNum="" then exit sub


	i=Cint(chNum)
	if i<1 or i>21 then
	cateid = IMC.RoomInfo(IMC.roomID,7)
	else
	cateid = IMC.RoomInfo(IMC.EnumRoom(i, 0),7)
	end if
	if cateid = -1 then
		pgtx.document.write(strTemp1)
		exit sub
	end if
	room_id = IMC.EnumRoom(cateid, 0)
	pgtx.document.write("<br>")
	while room_id
		strTemp = "<a href = # onclick = 'top.ct.DoEnterRoom(" & room_id & ");return false'><font color='blue'>【" & cate_name(cateid) & "】" &IMC.RoomName(room_id) & "（" & room_id & "）" & "额定：" & IMC.RoomInfo(room_id, 1) & "人" & "   当前在线：" & IMC.RoomInfo(room_id, 9) & "人</font></a><br>"
		room_id = IMC.EnumRoom(cateid, room_id)
		pgtx.document.write(strTemp)
	Wend
	cateid = IMC.RoomInfo(IMC.roomID,7)
	tf
end sub

public autoClear,timeClear
timeClear = "5"

sub btnClear_onclick	'自动清屏
	if btnClear.value = "自动清屏" then
		btnClear.value = "停止清屏"
		timeClear = inputbox("请输入自动清屏时间，系统默认自动清屏间隔时间为5分钟","清屏间隔时间设置","5")
		if Cint(timeClear) <= 0 or Cint(timeClear) > 60 then
			btnClear.value = "自动清屏"
			exit sub
		end if
		call startClear()
	else
		btnClear.value = "自动清屏"
		pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经关闭了“自动清屏”功能。</font><br>")
		clearTimeout(autoClear)
		timeClear = "5"
	end if
end sub

sub startClear()

    ClearTextWindow()
	pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经开启了“自动清屏”功能。</font><br>")
end sub

public sp_id
sp_id = 0

public timeForbid
timeForbid="100"

sub autoForbid_onclick	'封杀刷屏
	if IMC.Userinfo(self_id,0)<=5 then
		msgbox "您没有权限执行该功能！"
		exit sub
	end if
	if autoForbid.value = "封杀刷屏" then
		autoForbid.value = "停封刷屏"
		timeForbid = inputbox("请输入封杀刷屏的计算时间（毫秒），系统默认刷屏的计算时间间隔为100毫秒，建议在进行“猫抓老鼠”的游戏时不要开启本功能。","封杀刷屏的时间设置","500")
		if Cint(timeForbid) <= 0 or Cint(timeForbid) > 3000 then exit sub
		pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经开启了“自动防刷”功能，系统会自动踢出或封出限定时间内（默认为500毫秒）多次发言的人。您可以自定义设定时间，建议设定在50-100。</font><br>")
	else
		autoForbid.value = "封杀刷屏"
		pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经关闭了“封杀刷屏”功能。</font><br>")
		timeForbid="100"
	end if
end sub

SUB autoOPFenShua(fs_id)
	dim i,j
	for i = 0 to 5
		if arrSP(i,0) < 1 or arrSP(i,0) > 999 then
				exit for
		else
			if arrSP(i+1,0) = arrSP(i,0) then
				if (arrSP(i+1,1) - arrSP(i,1)) > 0 and (arrSP(i+1,1) - arrSP(i,1)) < Cint(timeForbid) then
						autoFenShua=true
						sp_id=arrSP(i,0)
						autofenti
						for j = 0 to 6
							if arrSP(j,0) = sp_id then arrSP(j,0) = 0
						next
						exit for
				end if
			end if
		end if
	next
end SUB

sub autofenti
	dim i
	if sp_id = 0 then exit sub
	if autoFenShua=true THEN
		if IMC.UserInfo(self_id,0) <= 5 then
			exit sub
		elseif IMC.UserInfo(self_id,0) <= 5 then
			IMC.OPKick sp_id, "刷屏可耻！"
		elseif IMC.UserInfo(self_id,0) > 5 then
			IMC.OPKick sp_id, "刷屏可耻！"
		end if
	end if
end sub

sub initialization
	dim i,j
	arrSP(0,1) = 99999999999
	arrSP(0,0) = 900
	for i = 1 to 6
		arrSP(i,0) = arrSP(i-1,0)+1
		arrSP(i,1) = arrSP(i-1,1)+10000
	next
	fname1.value = "名1"
	fname2.value = "名2"
	fname3.value = "名3"
	fname4.value = "名4"
	fname5.value = "名5"
	fname6.value = "名5"
	fname7.value = "名6"
	fname8.value = "名6"
	fname9.value = "名7"
	fname10.value = "名7"
	fname11.value = "名8"
	fname12.value = "名8"
	fname13.value = "名9"
	fname14.value = "名9"
	fname15.value = "名9"
	fname16.value = "名10"
	fname17.value = "名10"
	fname18.value = "名10"
	fname19.value = "名11"
	fname20.value = "名11"
	fname21.value = "名11"
	fsmut1.value = "骂1"
	fsmut2.value = "骂2"
	fsmut3.value = "骂3"
	fsmut4.value = "骂4"
	fsmut5.value = "骂5"
	fsmut6.value = "骂5"
	fsmut7.value = "骂6"
	fsmut8.value = "骂6"
	fsmut9.value = "骂7"
	fsmut10.value = "骂7"
	fsmut11.value = "骂8"
	fsmut12.value = "骂8"
	fsmut13.value = "骂9"
	fsmut14.value = "骂9"
	fsmut15.value = "骂9"
	fsmut16.value = "骂10"
	fsmut17.value = "骂10"
	fsmut18.value = "骂10"
	fsmut19.value = "骂11"
	fsmut20.value = "骂11"
	fsmut21.value = "骂11"
end sub

PUBLIC autofangti
autofangti = 0

SUB fangfenti_onclick
    Dim strTemp
	if IMC.Userinfo(self_id,0) < 3 then
		msgbox "您没有权限执行该功能！"
		exit sub
	end if
    strTemp = "友情提示:本房间开启了自动反踢功能，有管理权限的朋友请不要随意踢人，否则会被自动反踢出本房间，如有人捣乱请封闭它的说、写权限或者提交给< "&selfnick&" ("&IMC.SelfInfo(6)&") >来处理！谢谢！祝大家玩得开心愉快！" & CurrentColor & CurrentFont & CurrentBColor
    IF fangfenti.value = "反封反踢" then
    	        fangfenti.value = "停反封踢"
                autofangti = 1
                CALL IMC.PubText(0, strTemp)
    ELSE
            fangfenti.value = "反封反踢"
            autofangti = 0
    END IF
END SUB

'封说写
SUB Fenshuoxie_onclick
	tf
	IF sel_uid=0 THEN MsgBox "您不能禁止所有人": EXIT SUB
	IMC.OPSetUserPriv sel_uid, 0, 1, 0, 1, -1
END SUB

'全封
SUB Quanfen_onclick
	tf
	IF sel_uid=0 THEN MsgBox "您不能禁止所有人": EXIT SUB
	IMC.OPSetUserPriv sel_uid, 0, 0, 0, 0, -1
END SUB

'全解
SUB Quanjie_onclick
	tf
	IF sel_uid=0 THEN MsgBox "您不能选择所有人": EXIT SUB
	IMC.OPSetUserPriv sel_uid, 1, 1, 1, 1, -1
END SUB






Sub setYzdy(nIndex)
	DIM strTemp,strTemp1,strTemp2
	SELECT CASE nIndex
	Case 0:
	Case 1:
		strTemp1 = "//bearhug" & CurrentColor & CurrentFont & CurrentBColor
		strTemp2 = "//:)" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp1) ELSE CALL IMC.PubText(sel_uid, strTemp1)
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp2) ELSE CALL IMC.PubText(sel_uid, strTemp2)
	Case 2:
	    strTemp1 = "//hand" & CurrentColor & CurrentFont & CurrentBColor
	    strTemp2 = "//hi" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp1) ELSE CALL IMC.PubText(sel_uid, strTemp1)
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp2) ELSE CALL IMC.PubText(sel_uid, strTemp2)
	Case 3:
	    strTemp = "//clap" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 4:
	    strTemp = "哈哈哈哈哈......你太逗了！" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 5:
	    strTemp = "我溜溜去，有空再来看你！" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 6:
	    strTemp = "你就忽悠吧！可劲的忽悠！" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 7:
	    strTemp = "拒绝忽悠！不准忽悠我！再忽悠我我就鄙视你！" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 8:
	    strTemp = "有朋友找我有事，去去就来。" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 9:
	    strTemp = "我走了，您玩得开心！88...闪..." & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 10:
	    strTemp = "88，开心！" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 11:
	    strTemp = "我要下了，我要下了，我要收线啦~~~" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 12:
	    strTemp = "撑不住了，上眼皮和下眼皮直打架！俺先撤退了..." & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 13:
	    strTemp = "哇~哇~哇~~~帅帅~~N久没见到过帅帅了~~~有QQ没~~我们聊聊好不~~~" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 14:
	    strTemp = "你是鲜花，我愿做你的绿叶！你是雅典娜，我愿做你的守护神！茫茫人海中，你我在这里相遇，天赐良缘，让我们做个朋友吧~~~" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 15:
	    strTemp = "神啊~~~救救我吧~~~" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 16:
	    strTemp = "饿~我饿~~我好饿呀~~~前胸都快贴后背了。" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 17:
	    strTemp = "哇噻~~~什么好东东那么引诱人哪，别来馋我！哈喇子都快流出来了~~~" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 18:
	    strTemp = "祝您好胃口！慢慢吃，我就不来抢了哈~~~" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	Case 19:
	    strTemp = "您辛苦了，来杯龙井，休息一下。" & CurrentColor & CurrentFont & CurrentBColor
		IF userPM THEN CALL IMC.PrivText(sel_uid, strTemp) ELSE CALL IMC.PubText(sel_uid, strTemp)
	END SELECT
End Sub

Sub CtrlPan(nIndex)
'OP控制面板
'速封说写
'全部禁止
'全部解除
'管理后台
'查找用户
'高级挂管
	dim selfLevel, selLevel
	SelfLevel = IMC.UserInfo(self_id, 0)
	SelLevel = IMC.UserInfo(sel_uid, 0)
	tf
	SELECT CASE nIndex
	Case 0:
	Case 1:
		IF sel_uid=0 or SelfLevel < 2 or SelfLevel<= SelLevel THEN
			MsgBox "您不能执行该功能"
			EXIT SUB
		END IF
		IMC.OPSetUserPriv sel_uid, 0, 1, 0, 1, -1
	Case 2:
		IF sel_uid=0 or SelfLevel < 2 or SelfLevel<= SelLevel THEN
			MsgBox "您不能执行该功能"
			EXIT SUB
		END IF
		IMC.OPSetUserPriv sel_uid, 0, 0, 0, 0, -1
	Case 3:
		IF sel_uid=0 or SelfLevel < 2 or SelfLevel<= SelLevel THEN
			MsgBox "您不能执行该功能"
			EXIT SUB
		END IF
		IMC.OPSetUserPriv sel_uid, 1, 1, 1, 1, -1
	Case 4:
	window.open "http://sayliao.com","_blank","toolbar=no,menubar=no,scrollbars=no, resizable=yes,location=no, status=no ,resizable=yes"
	Case 5:
	Case 6:
	Case 7:
		dim opLevel
		IF sel_uid=0 or SelfLevel < 3 THEN MsgBox "您不能禁止所有人或不能执行该功能": EXIT SUB
		opLevel=inputbox("请输入管号等级（1-"&SelfLevel-1&"）","高级挂管",1)
		if Cint(opLevel)>=SelfLevel or SelfLevel<=SelLevel then MsgBox "您不能执行该功能":EXIT SUB
		IMC.OPSetUserPriv sel_uid, -1, -1, -1, -1, opLevel
	Case 8:
		IF sel_uid=0 or SelfLevel < 3 or SelfLevel<=SelLevel THEN MsgBox "您不能执行该功能": EXIT SUB
		IMC.OPSetUserPriv sel_uid, -1, -1, -1, -1, 0
	END SELECT
End Sub

SUB emcee_onclick
        IF emcee.value = "主持功能" then
    	        emcee.value = "停止主持"
                autoemcee = 1
        	pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经开启了“主持功能”功能，999排麦后会自动发布麦序，同时系统会自动删除上麦者的排麦麦序。</font><br>")
        ELSE
            emcee.value = "主持功能"
            pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已关闭“主持功能”功能。</font><br>")

            autoemcee = 0
        END IF
END SUB

SUB Bgmx(uid)
        Dim strTemp1,strTemp2
        strTemp1 = "您好，收到您的777彪歌请求，请稍等！为了尊重他人，彪歌只能唱半首歌曲，谢谢！" & CurrentColor & CurrentFont & CurrentBColor
        strTemp2 = "您好，目前的麦序过多，暂时不受理彪歌麦序，请见谅！" & CurrentColor & CurrentFont & CurrentBColor
        IF btBgmx.checked = true then
            CALL IMC.PrivText(uid, strTemp1)
        ELSE
            CALL IMC.PrivText(uid, strTemp2)
        END IF
END SUB

'public autoOver,overID
'autoOver = false
'overID = 0

sub ftname_onclick
	pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:“封名”功能是默认开启的，若名字中含有污秽言辞将被系统会自动踢出或封IP。您可以在名1~名11的自定义屏蔽词组中设定需要屏蔽的词语。若你没有管理权限，该功能不会执行。</font><br>")
end sub

sub autoOPftname(ftid) '封名

	if ftid <=0 then exit sub
	if ftid = self_id then exit sub
	if IMC.UserInfo(self_id,0) < 2 then 
		exit sub
	elseif IMC.UserInfo(self_id,0) >= 3 and IMC.UserInfo(self_id,0) <= 9 then
		'IMC.OPSetNick ftid, "Say聊不欢迎你"
		IMC.OPKick ftid, "刷屏？知道惨字怎么写了吗！"
		exit sub
	elseif IMC.UserInfo(self_id,0) >= 12 then

		'IMC.OPSetNick ftid, "Say聊不欢迎你"
		IMC.OPBanIP ftid, "刷屏？知道惨字怎么写了吗！" 'OPBanIP
	end if
end sub



SUB ftsmut_onclick	'封骂
	if IMC.UserInfo(self_id,0) < 2 then msgbox "你的权限不够，不能使用该功能。" : exit sub
	IF ftsmut.value = "封骂" THEN
		ftsmut.value = "停封"
		pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经开启了“封骂”功能，若有人发送污秽言辞将被系统会自动踢出或封IP。您可以在骂1~骂11的自定义屏蔽词组中设定需要屏蔽的词语。</font><br>")
		autoFTsmut = true
	ELSE 
		ftsmut.value = "封骂"
		pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经关闭了“封骂”功能。</font><br>")
		autoFTsmut = false
	END IF
END SUB

sub autoOPftsmut(smutid)	'封骂

	if smutid = self_id then exit sub
	if smutid <= 0 then exit sub
	if autoFTsmut = true THEN
		if IMC.UserInfo(self_id,0) < 2 then 
			exit sub
		elseif IMC.UserInfo(self_id,0) >= 3 and IMC.UserInfo(self_id,0) <= 9 then
			'IMC.OPSetNick smutid, "Say聊不欢迎你"
			IMC.OPKick smutid, "满嘴喷粪！"
			exit sub
		elseif IMC.UserInfo(self_id,0) >= 10 then
			'IMC.OPSetNick smutid, "Say聊不欢迎你"
			IMC.OPKick smutid, "满嘴喷粪！" 'OPBanIP
		end if
	end if
end sub

sub ftuseruid_onclick
	dim useruid
	useruid = InputBox("请输入欲踢出的用户UID号","封踢UID","")
	IF LEN(useruid)=0 THEN EXIT SUB
	if IMC.UserInfo(self_id,0) < 2 then 
			exit sub
	elseif IMC.UserInfo(self_id,0) >= 3 and IMC.UserInfo(self_id,0) <= 9 then
			'IMC.OPSetNick useruid, "Say聊不欢迎你"
			IMC.OPKick useruid, "不要捣乱！"
			exit sub
	elseif IMC.UserInfo(self_id,0) >= 10 then
			'IMC.OPSetNick useruid, "Say聊不欢迎你"
			IMC.OPKick useruid, "Say聊不欢迎你！"
	end if
end sub

sub ftchgnick_onclick
	if IMC.UserInfo(self_id,0) < 2 then msgbox "你的权限不够，不能使用该功能。" : exit sub
	IF ftchgnick.value = "封踢改名" THEN
		ftchgnick.value = "停封改名"
		pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经开启了“封踢改名”功能，若别人在更改的昵称中包含污秽言词将被系统会自动踢出或封IP。您可以在名1~名11的自定义屏蔽词组中设定需要屏蔽的词语。</font><br>")
	ELSE 
		ftchgnick.value = "封踢改名"
		pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经关闭了“封踢改名”功能。</font><br>")
	END IF
end sub

sub autoGetOut
	set window.opener=nothing
	window.close()
	top.window.close()
end sub



SUB zsmic_onclick
        IF zsmic.value = "手动删麦" then
    	        zsmic.value = "自动删麦"
                autozsmic = 1
        	pgtxpv.document.write("<font style='FILTER: glow(color=#ff93a6,strength=2); COLOR: #ff0000; HEIGHT: 8pt;'>系统提示:你已经开启了“自动删麦”功能，系统会自动删除上麦者的排麦麦序。建议将“自动删麦”和“自发麦序”联合使用。</font><br>")
        ELSE
            zsmic.value = "手动删麦"
            autozsmic = 0
        END IF
END SUB




