function view(Url,Dwin,wid,hei)
{
var popup=window.open(Url,"","left=100,top=100,width="+wid+",height="+hei+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, resizable=no");
}
function js_callpage(htmlurl) {
  var 
newwin=window.open(htmlurl,"homeWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=430");
  newwin.focus();
  return false;
}

var focusok=false;
if (navigator.appName == "Netscape") {
	focusok=true;
}
vers = navigator.appVersion;
if (navigator.appName == "Microsoft Internet Explorer") {
 pos = vers.lastIndexOf('.'); 
 vers = vers.substring(pos-1,vers.length); 
}
proper_version = parseFloat(vers); 

if(proper_version>=5){
	focusok=true;
}

function launchchat() {

  var chat = window.open("","chat","top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=790,height=530");
   if(focusok){
	chat.focus();
   }
   return true;}

function direct()
{
	var t;
	t=document.directform.elements[0].value;
	var tt=t.charAt(0);
        if((t>0)||(tt=='t')||(tt=='T')){
                //launchchat();
                if((tt=='t')||(tt=='T')){
                	document.directform.action='http://garden.bliao.com/directt.phtml';
                }else{
                	document.directform.action='http://garden.bliao.com/direct.phtml';
                }
                document.directform.submit();
        }else{
        	alert("请输入聊天大观园的序号，或者特约聊天室的端口号(前面加'T')");
        }
}

//--- history start 如有更新请同时修改http://www.bliao.com/vnet/chat/header.js

function SetCookie (name,value,expires,path,domain,secure) {       
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}
function getCookie(name) {
	var bikky = document.cookie;
	name += "="; 
	var i = 0; 
	while (i < bikky.length) {
	var offset = i + name.length; 
	if (bikky.substring(i, offset) == name) { 
	var endstr = bikky.indexOf(";", offset); 
	if (endstr == -1) endstr = bikky.length;
	  return unescape(bikky.substring(offset, endstr)); 
	}
	i = bikky.indexOf(" ", i) + 1; 
	if (i == 0) break; 
	}
	return null; 
}
function uphistory(no,roomname){
	
	var bliaologhistory="";
	if (getCookie("bliaologhistory")){
		bliaologhistory=getCookie("bliaologhistory");
		
		nlist=bliaologhistory.split("\n");
		nlist.length --;
		if (nlist.length>10) {
			bliaologhistory=""
			for (i=9;i>=0;i--){
				bliaologhistory=nlist[i]+"\n"+bliaologhistory
			}
		}

		tmp=new String("\n"+bliaologhistory)
		pattern =eval("tmp.match(/\\n"+no+"\\t/ig)");
		if (pattern) return;
	}
	bliaologhistory=no+"\t"+roomname+"\n"+bliaologhistory
	
	var expdate = new Date();
	expdate.setTime (expdate.getTime() + 15 * (24 * 60 * 60 * 1000));
	SetCookie("bliaologhistory",bliaologhistory,expdate,"/","bliao.com");
	SetCookie("bliaologhistory",bliaologhistory,expdate,"/","yinsha.com");
	SetCookie("bliaologhistory",bliaologhistory,expdate,"/","silversand.net");
}

var historylog
function clearhistory(){
	if (getCookie("bliaologhistory")){
		SetCookie("bliaologhistory","","","","bliao.com");
		SetCookie("bliaologhistory","","","","yinsha.com");
		SetCookie("bliaologhistory","","","","silversand.net");
	}
	historylog="<table border=0><tr><td>无访问历史记录<a href='javascript:location.reload()'>·刷新·</a></td></tr></table>";
	hidemenu()
	return;
}
function gethistory(){
	if (getCookie("bliaologhistory")){
		historylog=getCookie("bliaologhistory")
		nlist=historylog.split("\n");
		historylog="<table border=0><tr><td align=center>聊天室访问历史记录<hr size=1 width=90% align=center></td></tr>";
		nlist.length --;
		if (nlist.length>10) nlist.length=10;
		for (i=0;i<nlist.length;i++){
			npair=nlist[i].split("\t");
			historylog=historylog+"<tr><td><a href='http://"+npair[0]+".bliao.com' target=_blank>·["+npair[0]+"] "+npair[1]+"</a></td></tr>"
		}
		historylog=historylog+"<tr><td><hr size=1 width=90% align=center></td></tr><tr><td align=center><a href='javascript:location.reload()'>·刷新·</a><a href='javascript:clearhistory()'>·清除·</a></td></tr></table>"
	}else{
		historylog="<table border=0><tr><td>无访问历史记录<a href='javascript:location.reload()'>·刷新·</a></td></tr></table>";
	}
	return historylog;
}
function getfavor(){
	var objHttp = new ActiveXObject("Microsoft.XMLHTTP");				
	url2 = "http://"+top.location.hostname+"/pplogin/addfavor.php?actionmode=list";
	objHttp.open("GET",url2,false);
	objHttp.send();
	if ( objHttp.status != 200 ){
		return false;
	}else{
		favorlog=objHttp.responseText;
		targeturl = top.location;
		if (favorlog){
			nlist=favorlog.split("\n");
			favorlog="<table border=0><tr valign='middle'><td align=center>聊天室收藏记录</td><td><a onclick='hidemenu()' href='javascript:hidemenu()'><font color=#FF4444><u>关闭</u></font></a></td></tr><tr valign='middle'><td colspan=2><hr size=1 width=90% align=center></td>";
			for (i=0;i<nlist.length;i++){
				npair=nlist[i].split("\t");
				favorlog=favorlog+"<tr><td>·<a href='http://"+npair[0]+".bliao.com' target=_blank>["+npair[0]+"] "+npair[1]+"</a></td><td><a target='_top' href='/pplogin/addfavor.php?targeturl="+targeturl+"&actionmode=del&roomid="+npair[0]+"'>删</a></td></tr>"
			}
		}else{
			favorlog="<table border=0><tr><td>无收藏记录<a onclick='hidemenu()' href='javascript:hidemenu()'><font color=#FF4444><u>关闭</u></font></a></td></tr></table>";
		}
		return favorlog;
	}
}

var menuOffX=0	//菜单距连接文字最左端距离
var menuOffY=18	//菜单距连接文字顶端距离
var fo_shadows=new Array();
historylog=gethistory();
function showmenu(){
	if (!document.all) return;
	clearhidemenu();
	ie_clearshadow();
	menuobj=document.all.popmenu;
	menuobj.thestyle=menuobj.style;
	menuobj.innerHTML=historylog;
	menuobj.contentwidth=menuobj.offsetWidth;
	menuobj.contentheight=menuobj.offsetHeight;
	eventX=event.clientX
	eventY=event.clientY
	var rightedge=document.body.clientWidth-eventX
	var bottomedge=document.body.clientHeight-eventY
	var getlength
	if (rightedge<menuobj.contentwidth){
		getlength=document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX
	}else{
		getlength=ie_x(event.srcElement)+menuOffX
	}
	menuobj.thestyle.left=getlength+'px'
	if (bottomedge<menuobj.contentheight){//&&mod!=0
		getlength=document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23
	}else{
		getlength=ie_y(event.srcElement)+menuOffY
	}
	menuobj.thestyle.top=getlength+'px'
	menuobj.thestyle.visibility="visible"
	ie_dropshadow(menuobj,"#999999",3)
	return false
}
//内嵌iframe方式
function showmenu_ifr(e){
	if (!document.all) return;
	clearhidemenu();
	ie_clearshadow();
	menuobj=document.all.popmenu;
	menuobj.thestyle=menuobj.style;
	menuobj.innerHTML=historylog;
	menuobj.contentwidth=menuobj.offsetWidth;
	menuobj.contentheight=menuobj.offsetHeight;
	thise=e
	var t=e.offsetTop;
	var l=e.offsetLeft;
	while(e=e.offsetParent){
		t+=e.offsetTop; l+=e.offsetLeft;
	}
	menuobj.thestyle.top=(t+ thise.offsetHeight)+ "px";
	menuobj.thestyle.left=(l+ thise.offsetWidth - menuobj.offsetWidth )+ "px";
	menuobj.thestyle.visibility="visible"
	ie_dropshadow(menuobj,"#999999",3)

}
function ie_y(e){  
	var t=e.offsetTop;  
	while(e=e.offsetParent){  
		t+=e.offsetTop;  
	}  
	return t;  
}  
function ie_x(e){  
	var l=e.offsetLeft;  
	while(e=e.offsetParent){  
		l+=e.offsetLeft;  
	}  
	return l;  
}  
function ie_dropshadow(el, color, size)
{
	var i;
	for (i=size; i>0; i--)
	{
		var rect = document.createElement('div');
		var rs = rect.style
		rs.position = 'absolute';
		rs.left = (el.style.posLeft + i) + 'px';
		rs.top = (el.style.posTop + i) + 'px';
		rs.width = el.offsetWidth + 'px';
		rs.height = el.offsetHeight + 'px';
		rs.zIndex = el.style.zIndex - i;
		rs.backgroundColor = color;
		var opacity = 1 - i / (i + 1);
		rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
		//el.insertAdjacentElement('afterEnd', rect);
		fo_shadows[fo_shadows.length] = rect;
	}
}
function ie_clearshadow()
{
	for(var i=0;i<fo_shadows.length;i++)
	{
		if (fo_shadows[i])
			fo_shadows[i].style.display="none"
	}
	fo_shadows=new Array();
}
function hidemenu(){
	if (window.menuobj)
		menuobj.thestyle.visibility="hidden"
	ie_clearshadow()
	if(parent){
		if(parent.test){
			parent.test('35');
		}
	}
}

function dynamichide(e){
	if (!menuobj.contains(e.toElement))
		hidemenu()
}

function clearhidemenu(){
	if (window.delayhide)
		clearTimeout(delayhide)
}

function showmenu(){
	if (!document.all) return;
	clearhidemenu();
	ie_clearshadow();
	menuobj=document.all.popmenu;
	menuobj.thestyle=menuobj.style;
	menuobj.innerHTML=historylog;
	menuobj.contentwidth=menuobj.offsetWidth;
	menuobj.contentheight=menuobj.offsetHeight;
	eventX=event.clientX
	eventY=event.clientY
	var rightedge=document.body.clientWidth-eventX
	var bottomedge=document.body.clientHeight-eventY
	var getlength
	if (rightedge<menuobj.contentwidth){
		getlength=document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX
	}else{
		getlength=ie_x(event.srcElement)+menuOffX
	}
	menuobj.thestyle.left=getlength+'px'
	if (bottomedge<menuobj.contentheight){//&&mod!=0
		getlength=document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23
	}else{
		getlength=ie_y(event.srcElement)+menuOffY
	}
	menuobj.thestyle.top=getlength+'px'
	menuobj.thestyle.visibility="visible"
	ie_dropshadow(menuobj,"#999999",3)
	return false
}
function showfavor(){
	if (!document.all) return;
	clearhidemenu();
	ie_clearshadow();
	menuobj=document.all.popmenu;
	menuobj.thestyle=menuobj.style;
	favorlog=getfavor();
	menuobj.innerHTML=favorlog;
	menuobj.contentwidth=menuobj.offsetWidth;
	menuobj.contentheight=menuobj.offsetHeight;
	eventX=event.clientX
	eventY=event.clientY
	var rightedge=document.body.clientWidth-eventX
	var bottomedge=document.body.clientHeight-eventY
	var getlength
	if (rightedge<menuobj.contentwidth){
		getlength=document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX
	}else{
		getlength=ie_x(event.srcElement)+menuOffX
	}
	if(getlength<0) getlength=0;
	menuobj.thestyle.left=getlength+'px'
	if (bottomedge<menuobj.contentheight){//&&mod!=0
		getlength=document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23
	}else{
		getlength=ie_y(event.srcElement)+menuOffY
	}
	if(getlength<0) getlength=0;
	menuobj.thestyle.top=getlength+'px'
	menuobj.thestyle.visibility="visible"
	ie_dropshadow(menuobj,"#999999",3)
	return false
}
//---history-end
