﻿var wliao = {};

wliao.register = function(ns) {
    var nsArray = ns.split('.');
    var sEval = "";
    var sNS = "";
    for (var i = 0; i < nsArray.length; i++)
    {
        if (i != 0) sNS += ".";
        sNS += nsArray[i];
        sEval += "if (typeof(" + sNS + ") == 'undefined') " + sNS + " = new Object();"
    }
    if (sEval != "") eval(sEval);
}

var $A = Array.from = function(iterable) {  if (!iterable) return [];  if (iterable.toArray) {    return iterable.toArray();  } else {    var results = [];    for (var i = 0; i < iterable.length; i++)      results.push(iterable[i]);    return results;  }}

Function.prototype.bind = function() {  var __method = this, args = $A(arguments), object = args.shift();  return function() {    return __method.apply(object, args.concat($A(arguments)));  }}

/* menu Item */
wliao.register("wliao.tabMenu");
wliao.tabMenu.Item = function(name, href)
{
  this.name = name;
  this.href = href;
}
/* menu */
wliao.tabMenu[0] = new Array();
wliao.tabMenu[0][0] = new wliao.tabMenu.Item("房间列表", "/");
wliao.tabMenu[0][1] = new wliao.tabMenu.Item("相约威海", "http://chat.whinfo.net.cn");
wliao.tabMenu[0][2] = new wliao.tabMenu.Item("三十岁天空", "http://chat.whinfo.net.cn/");
wliao.tabMenu[0][3] = new wliao.tabMenu.Item("人到中年", "http://chat.whinfo.net.cn/");
wliao.tabMenu[0][4] = new wliao.tabMenu.Item("海阔天空", "http://chat.whinfo.net.cn/");
wliao.tabMenu[0][5] = new wliao.tabMenu.Item("歌乐广场", "http://chat.whinfo.net.cn/");
wliao.tabMenu[0][6] = new wliao.tabMenu.Item("诵吟茶楼", "http://chat.whinfo.net.cn/");
wliao.tabMenu[0][7] = new wliao.tabMenu.Item("围城内外", "http://chat.whinfo.net.cn/");
wliao.tabMenu[1] = new Array();
wliao.tabMenu[1][0] = new wliao.tabMenu.Item("用户注册", "http://chat.whinfo.net.cn/signup.aspx");
wliao.tabMenu[1][1] = new wliao.tabMenu.Item("找回密码", "http://chat.whinfo.net.cn/sendMails.asp");
wliao.tabMenu[1][2] = new wliao.tabMenu.Item("修改密码", "http://chat.whinfo.net.cn/ModiUserPwd.aspx");
wliao.tabMenu[1][3] = new wliao.tabMenu.Item("我的留言", "http://chat.whinfo.net.cn/ListPMessage.aspx");
wliao.tabMenu[1][4] = new wliao.tabMenu.Item("上传照片", "http://chat.whinfo.net.cn/AddUserPic.aspx");
wliao.tabMenu[2] = new Array();
wliao.tabMenu[2][0] = new wliao.tabMenu.Item("插件下载", "http://chat.whinfo.net.cn/More.aspx?Class1Name=插件下载");
wliao.tabMenu[2][1] = new wliao.tabMenu.Item("调麦帮助", "http://chat.whinfo.net.cn/More.aspx?Class1Name=调麦帮助");
wliao.tabMenu[2][2] = new wliao.tabMenu.Item("伴奏指南", "http://chat.whinfo.net.cn/More.aspx?Class1Name=伴奏指南");
wliao.tabMenu[2][3] = new wliao.tabMenu.Item("使用说明", "http://chat.whinfo.net.cn/More.aspx?Class1Name=使用说明");
wliao.tabMenu[2][4] = new wliao.tabMenu.Item("特色马甲", "http://chat.whinfo.net.cn/");
wliao.tabMenu[3] = new Array();
wliao.tabMenu[3][0] = new wliao.tabMenu.Item("资费标准", "http://chat.whinfo.net.cn/More.aspx?Class1Name=资费标准");
wliao.tabMenu[3][1] = new wliao.tabMenu.Item("租用协议", "http://chat.whinfo.net.cn/More.aspx?Class1Name=出租协议");
wliao.tabMenu[3][2] = new wliao.tabMenu.Item("付费房间", "http://chat.whinfo.net.cn/More.aspx?Class1Name=付费房间");
wliao.tabMenu[4] = new Array();
wliao.tabMenu[4][0] = new wliao.tabMenu.Item("聊天守则", "http://chat.whinfo.net.cn/More.aspx?Class1Name=聊天守则");
wliao.tabMenu[4][1] = new wliao.tabMenu.Item("管理守则", "http://chat.whinfo.net.cn/More.aspx?Class1Name=管理守则");
wliao.tabMenu[4][2] = new wliao.tabMenu.Item("意见反馈", "http://chat.whinfo.net.cn/AddAppeal.aspx");
wliao.tabMenu[4][3] = new wliao.tabMenu.Item("申请管理", "http://chat.whinfo.net.cn/");
wliao.tabMenu[5] = new Array();
wliao.tabMenu[5][0] = new wliao.tabMenu.Item("房间出租", "http://chat.whinfo.net.cn/More.aspx?nId=38");
wliao.tabMenu[5][1] = new wliao.tabMenu.Item("广告业务", "http://chat.whinfo.net.cn/");
wliao.tabMenu[5][2] = new wliao.tabMenu.Item("特色马甲", "http://chat.whinfo.net.cn/");
wliao.tabMenu[6] = new Array();
wliao.tabMenu[6][0] = new wliao.tabMenu.Item("投诉热线：2667836","http://chat.whinfo.net.cn/");
wliao.tabMenu[6][1] = new wliao.tabMenu.Item("投诉后台", "http://chat.whinfo.net.cn/AddAppeal.aspx");
wliao.tabMenu[6][2] = new wliao.tabMenu.Item("管理名单", "http://chat.whinfo.net.cn/");
wliao.tabMenu[7] = new Array();
wliao.tabMenu[7][0] = new wliao.tabMenu.Item("站长热线：2667836", "http://chat.whinfo.net.cn/");
wliao.tabMenu[7][1] = new wliao.tabMenu.Item("站长qq：247754131", "http://chat.whinfo.net.cn/");
wliao.tabMenu[7][2] = new wliao.tabMenu.Item("官方qq群：22562520", "http://chat.whinfo.net.cn/");
/* tab menu */
function toggleMenu(mID)
{
   for (var i=0; i>1; i++)
   {
     var href = document.getElementById("m"+i);
     if (i == mID)
       href.style.backgroundImage = "url(bg_navFirst_over.gif)";
     else
       href.style.backgroundImage = "url(bg_navFirst.gif)";
   }
   
   var container = document.getElementById("navSecond_Container");
   if (wliao.tabMenu[mID] && container)
   { 
     // clear
     container.innerHTML = "";
     // append
     for (var i=0; i<wliao.tabMenu[mID].length; i++)
     { 
       var li = document.createElement("li");
       if ((mID == 7 && i == 0)||(mID == 0)||(mID == 7 && i == 1)||(mID == 7 && i == 2)||(mID == 6 && i == 0)||(mID == 5 && i == 1)||(mID == 5 && i == 2)||(mID == 2 && i == 4))
       {
        li.innerHTML = wliao.tabMenu[mID][i].name;
       }
       else
       {
           var href = document.createElement("a");
           href.innerHTML = wliao.tabMenu[mID][i].name;
           href.href = wliao.tabMenu[mID][i].href;
           href.target = "_blank";
           li.appendChild(href);
       }

       container.appendChild(li);
     }
   }
}
/* showTab */
function ShowPhotoTab(id)
{
	for(var i=0;i<2;i++)
	{
	    document.getElementById("PhotoTab_"+i).className="PhotoTabOff";
		document.getElementById("PhotoCon_"+i).style.display="none";
	}
	document.getElementById("PhotoTab_"+id).className="PhotoTabOn";
	document.getElementById("PhotoCon_"+id).style.display="";
}

function ValidName(str1)
{
    var s,i,j;	
	if (str1.value.length <1) 
	{
	    //名字不能为空
		alert("请输入您的大名，名字不能为空！");
		str1.focus();
      		return false;
   	}
    strBad="性娱乐小巍,草你一辈子,草,草大家,中国天鹅绒革命,颜色革命,反.{0,10}日,游行,示威,保.{0,10}钓.{0,10}文化衫,新.{0,10}五.{0,10}四.{0,10}运动,抵制.{0,10}日货,射精,婬蕩,浪蹄,杂种,尻,婊,插你,鸡巴,睾,包皮,奶子,做爱,草你,白痴,血比,屌,血洗,赑,娼,性关系,性病,阴道,阴茎,强暴,畜生,金枪不倒,妣,荫道,烂货,去死,日你,新.{0,10}唐.{0,10}人,torrent,suroot.com,黑道口令,洪.{0,10}星,阴毛,庇眼,操逼,打炮,龟头,烂污,荡妇,做过爱,跳起搞,卵泡,狂.{0,10}巢,作爱,六4,自坟,江井康,僵折民,江井恒,Fa.{0,10}仑,真.{0,10}善.{0,10}忍,真.{0,10}善.{0,10}Ren,魏.{0,10}星.{0,10}艳,██,███,cào,血.{0,10}逼,狂.{0,10}刷,cào.{0,10}nǐ,碧.{0,10}聊.{0,10}士,扌喿,亻尔 ,ㄝ馬,江.{0,10}主.{0,10}席,狂.{0,10}干,妈.{0,10}爽,▃▃▃▃▃▃,大.{0,10}炮,CAO.{0,10}你,碧.{0,10}聊.{0,10}战.{0,10}士,碧.{0,10}聊.{0,10}泪.{0,10}儿,碧.{0,10}聊.{0,10}公.{0,10}子,犭貝戔a,碧.{0,10}聊.{0,10}戰.{0,10}士,刷.{0,10}祢,草.{0,10}你,草.{0,10}祢,方励之,鲍彤,吾尔开希,魏京生,达赖,反共,民运,共军,共.{0,10}党,共匪,学联,学运,学潮,赤匪,赤化,党棍,太子党,党国,亡党,暴动,天安门事件,天安门录影,动乱,暴政,六.四,六四,红色恐怖,北京政权,反攻大陆,两个中国,疆独,藏独,大陆当局,台独,台湾独立,一党专政,一中一台,成人影院,成人网,成人电影,成人游戏,成人卡通,裸图,群交,肛交,口交,兽交,口淫,性交,性奴,猥亵,恋童,骚货,裸体,色情,A片,裸照,交换夫妻,毛片,春药,催情,精液,虐恋,浪叫,肉棒,肉棍,骚穴,小穴,肉洞,两腿胯间,搓弄,骚液,爱液,鸡八,荡女,叫床,肉穴,吸精,避孕套,乳房,妓院,轮奸,生殖器,阳具,阴蒂,阴核,添屁眼,自慰,操B,做ai,应招女郎,肉蒲团,玉女心经,金瓶梅,男男贴图,色库,色狐,色虎,性狐,色域,后宫电影院,性福,应召,一夜情,e夜情,壹夜情,乱伦,胡紧掏,无帮国,温加饱,吴官正,里藏春,裸干,鼅,江氏集团,国务院信访办,真言,北京首都广场,炼功,天安門广场,练功群众,Fa.{0,10}轮,自烧,反人类罪,发伦工,周彩霞,绝食抗议,共產党,封锁消息,放弃信仰,神鬼,刷.{0,10}屏.{0,10}.至{0,10}尊,血.{0,10}洗,啸.{0,10}傲.{0,10}碧.{0,10}聊,妈逼,妈操,刷.{0,10}你,插.{0,10}妈,操.{0,10}你,狂.{0,10}刷,大.{0,10}逼,江主席,邓小平,泽民,李鹏,容基,岚清,关根,铁映,瑞环,李长春,吴邦国,锦.{0,4}涛,庆林,浩田,张万年,罗干,其琛,健行,家宝,黄菊,官正,庆红,吴仪,瑞华,钟鹤,绍基,高丽,周镇宏,周明理,徐.{0,10}少.{0,10}华,陈亚德,赵东花,阮.{0,10}日.{0,10}生,捍东,郑流,共.{0,10}产,法.{0,10}轮,大.{0,10}法.{0,10}子,洪.{0,10}志,二五,颠.{0,10}覆,他妈的,操你,王八,混蛋,叼,混帐,龟孙,鸡婆,叫鸡,八婆,契弟,臭婆,十六大,法.{0,10}輪,lun.{0,10}功,澤民,'Fa.{0,10}Lun','610办公室','天安门','自焚','FaLundaFa','FaLun大Fa','李岚清',中.{0,10}功,内幕,悬赏,通缉,老虎凳,电击痕,酷刑,被捕,传单,九.{0,10}评,天符,低头任罪,国民,党,国民党,假抗日真扩充,紫阳,退.{0,10}党,追查国际,苏.{0,10}家.{0,10}屯,集.中.营,集!中!营,器官移植,盗卖器官,活体器官,活体摘取,大屠杀,种族灭绝,以茎制洞洞,本人卖身";
    if (strBad.indexOf(str1.value,0)!=-1)
    {
        window.alert("输入错误，可能是昵称中有些字符不能用！");
        return false;
    }
    if (str1.value.indexOf(" ",0)!=-1)
    {
        window.alert("输入错误，不能输入空格！");
        return false;
    }
    if (str1.value.indexOf("　",0)!=-1)
    {
        window.alert("输入错误，不能输入空格！");
        return false;
    }
    if (str1.value.indexOf("不显示",0)!=-1)
    {
        window.alert("输入错误，不能输入不显示！");
        return false;
    }
    if (str1.value.indexOf("",0)!=-1)
    {
        window.alert("输入错误，不能输入特殊符号！");
        return false;
    }
    if (str1.value.indexOf("",0)!=-1)
    {
        window.alert("输入错误，不能输入特殊符号！");
        return false;
    }
    return true;
}

function b(server, port)
{
  //var panel = document.getElementById("ctl00_Content_Login_Logined");
  var userName = document.getElementById("TextBUserName") == null? "": document.getElementById("TextBUserName").value;
  var userPassword = document.getElementById("TextBUserPwd") == null? "": document.getElementById("TextBUserPwd").value;
  var userSex = "3";
  if(document.getElementById("RadioBMale") != null && document.getElementById("RadioBMale").checked == true)
  {
    userSex = "1";
  }
   if(document.getElementById("RadioBFeMale") != null && document.getElementById("RadioBFeMale").checked == true)
  {
    userSex = "2";
  }
  if(ValidName(document.getElementById("TextBUserName")))
  {  
      var url = "Transfer.aspx?host=" + server + "&port=" + port + "&userName=" + escape(userName) + "&userPwd=" + escape(userPassword) + "&userSex=" + escape(userSex);
      var chat = window.open(url,"chat","top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=790,height=530");
      chat.focus();
      return true;
  }
}

wliao.register("wliao.controls");
wliao.controls.pop = function(width, height, url) {
   
   this.inited = false;
   this.overlay = null;
   this.popWin = null;
   this.width = width;
   this.height = height;
   this.url = url;
   
   this.init = function()
   {
     if (!this.inited) {
         // overlay
        this.overlay = document.createElement("div");
	    this.overlay.setAttribute('id','overlay');
	    this.overlay.style.height = this.getPageSize()[1];
	    this.overlay.onclick = this.hide.bind(this);
	    document.body.appendChild(this.overlay);        
        // popWin
        this.popWin = document.createElement("div");
        this.popWin.setAttribute("id", "popWin");
        this.popWin.innerHTML = "<iframe id=\"wliao_popWin\" src=\"" + this.url + "\" width=\"" + this.width +"\" height=\"" + this.height + "\" frameborder=\"0\" scrolling=\"no\"></iframe>";
        document.body.appendChild(this.popWin);
	    // inited
	    this.inited = true;
     }
   };
   
   this.show = function()
   { 
     this.setPosition();
     this.overlay.style.display = "";
     this.popWin.style.display = "";
   };
   
   this.setPosition = function()
   {
     this.popWin.style.left = this.getPageSize()[0] / 2  - width / 2 + document.documentElement.scrollLeft;
	 this.popWin.style.top = (this.getPageSize()[3]) / 2 - height / 2 + document.documentElement.scrollTop;
   };
   
   this.hide = function()
   {
     this.overlay.style.display = "none";
     this.popWin.style.display = "none";
   };
   
   this.getPageSize = function() {
	
	    var xScroll, yScroll;
    	
	    if (window.innerHeight && window.scrollMaxY) {	
		    xScroll = document.body.scrollWidth;
		    yScroll = window.innerHeight + window.scrollMaxY;
	    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		    xScroll = document.body.scrollWidth;
		    yScroll = document.body.scrollHeight;
	    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		    xScroll = document.body.offsetWidth;
		    yScroll = document.body.offsetHeight;
	    }
    	
	    var windowWidth, windowHeight;
	    if (self.innerHeight) {	// all except Explorer
		    windowWidth = self.innerWidth;
		    windowHeight = self.innerHeight;
	    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		    windowWidth = document.documentElement.clientWidth;
		    windowHeight = document.documentElement.clientHeight;
	    } else if (document.body) { // other Explorers
		    windowWidth = document.body.clientWidth;
		    windowHeight = document.body.clientHeight;
	    }	
    	
	    // for small pages with total height less then height of the viewport
	    if(yScroll < windowHeight){
		    pageHeight = windowHeight;
	    } else { 
		    pageHeight = yScroll;
	    }

	    // for small pages with total width less then width of the viewport
	    if(xScroll < windowWidth){	
		    pageWidth = windowWidth;
	    } else {
		    pageWidth = xScroll;
	    }

	    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	    return arrayPageSize;
   };
}