// JavaScript Document
var online=new Array();
if (!document.layers)
var qqNumber="935170451";
function onloadIni()
{
var mode='<div id="divStayTopLeft" style="position:absolute;z-index:8888;">';
mode+='<div style="width:108px;height:95px;">';
mode+='<img onclick="InviteOpen(935170451);" src="/images/bgpic/QQ.jpg" width="108" height="95" style="border-width: 0;cursor:pointer;" />';
mode+='</div>';
mode+='</div><div id="centerMess"></div>';
//document.getElementById("qqNumber").innerHTML+=mode;
document.write(mode);
}
var verticalpos="fromtop";
function JSFX_FloatTopDiv()
{
	onloadIni();	
	var startX = 920;
	startY = 80;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	function ml(id)
	{
		var el=document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
		if(document.layers)el.style=el;
		el.sP=function(x,y){this.style.pixelLeft=x;this.style.pixelTop=y;
		//document.getElementById('fuck').innerHTML= document.body.scrollTop+"|"+document.body.clientHeight+"|"+y;
		};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y =document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop"){
		var pY =document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
		var pY = document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		
		setTimeout("stayTopLeft()", 10);
			
	}
	ftlObj = ml("divStayTopLeft");
	stayTopLeft();
	
}

function InviteWindow_generate(){
	
		
		var bt1="";
		var bt2="";
		var baseUrl="/images/bgpic/";
		
				bt1="green_invite_bt1.gif";
				bt2="green_invite_bt2.gif";
			
		var inviteInnerHtml ='<table style="background-repeat:no-repeat" width="439" height="160" border="0" cellpadding="0" cellspacing="0" background="' +baseUrl+ 'green_invite_bg.gif">';
		inviteInnerHtml +='<tr style="cursor:move;"><td colspan="7" width="439" height="27"><span style="color:#FFFFFF;font-size:12px;">&nbsp;&nbsp;&nbsp;'+URLDecode('广州迈驰二手办公家私')+'</span></td></tr>';
		inviteInnerHtml +='<tr><td rowspan="3" width="132" height="132"></td>';
		inviteInnerHtml +='<td colspan="5" width="296" height="97">'+getInviteContent()+'</td>';
		inviteInnerHtml +='<td width="11" height="97"></td></tr>';
		inviteInnerHtml +='<tr><td width="141" height="22"></td>';
		inviteInnerHtml +='<td width="66" height="22"><img src="' +baseUrl+bt1+ '" onclick="talk(935170451);" style="cursor:pointer"></td>';
		inviteInnerHtml +='<td width="12" height="22"></td>';
		inviteInnerHtml +='<td width="66" height="22"><img src="' +baseUrl+bt2+ '" onclick="InviteClose();" style="cursor:pointer"></td>';
		inviteInnerHtml +='<td colspan="2" width="22" height="22"></td></tr>';
		inviteInnerHtml +='<tr><td colspan="6" width="307" height="13"></td></tr>';
		inviteInnerHtml +='<tr><td width="132" height="1"></td>';
		inviteInnerHtml +='<td width="141" height="1"></td>';
		inviteInnerHtml +='<td width="66" height="1"></td>';
		inviteInnerHtml +='<td width="12" height="1"></td>';
		inviteInnerHtml +='<td width="66" height="1"></td>';
		inviteInnerHtml +='<td width="11" height="1"></td>';
		inviteInnerHtml +='<td width="11" height="1"></td></tr></table>';
	var layerHtml = "<div id=\"InviteWindow\" onmousedown=\"popDivMoveStart()\" style=\"top:200px;left:500px;z-index:8888;position:absolute;display:none;\">";
	layerHtml += ""+inviteInnerHtml ;
	layerHtml += "</div>";
	document.getElementById("centerMess").innerHTML+=layerHtml;
}

function InviteOpen(num)
{
	qqNumber=num;
	if(!document.getElementById("InviteWindow"))
	{
		InviteWindow_generate();
	}
	document.getElementById("InviteWindow").style.display="";
	resizeInvite();
}
function InviteClose()
{
	document.getElementById("InviteWindow").style.display='none';
}
function talk(qqNumber)
{
	window.open('http://wpa.qq.com/msgrd?V=1&Uin='+qqNumber+'&Site=http://51wgw.zj.com&Menu=yes');
	InviteClose();
}
function resizeInvite(){
	var xhtmltop=((document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+( ((document.body.clientHeight > document.documentElement.clientHeight)?document.documentElement.clientHeight:document.body.clientHeight)-document.getElementById("InviteWindow").offsetHeight)/2);
	var htmltop=(document.body.scrollTop+(document.body.clientHeight-document.getElementById("InviteWindow").offsetHeight)/2);
	if(document.doctype){
		document.getElementById("InviteWindow").style.top=xhtmltop+"px";
	}else{
		if(document.documentElement.clientWidth){
			document.getElementById("InviteWindow").style.top=xhtmltop+"px";
		}else{
		document.getElementById("InviteWindow").style.top=htmltop+"px";}		
	}
	//document.getElementById("InviteWindow").style.top="210px";
	document.getElementById("InviteWindow").style.left=(document.body.scrollLeft+(document.body.clientWidth-document.getElementById("InviteWindow").offsetWidth)/2)+"px";
};

var popDivDiffX=null;
var popDivDiffY=null;
var floadttime;

function popDivMoveStart(){
	
	var InviteWindow=document.getElementById("InviteWindow");
	popDivDiffX=event.x-InviteWindow.style.pixelLeft;
	popDivDiffY=event.y-InviteWindow.style.pixelTop;
	window.document.body.attachEvent("onmousemove",popDivMove);
	window.document.body.attachEvent("onmouseup",popDivMoveStop);
	
};

function popDivMove(){
	if(popDivDiffX!=null){
		if(event.x<10 || event.y<10||event.x>document.body.clientWidth||event.y>document.body.clientHeight){
			popDivMoveStop();
			return;
		}
		document.getElementById("InviteWindow").style.pixelLeft=event.x-popDivDiffX;
		document.getElementById("InviteWindow").style.pixelTop=event.y-popDivDiffY;
	}
	
};

function popDivMoveStop(){
	if(popDivDiffX != null){
		document.getElementById("InviteWindow").releaseCapture();
		popDivDiffX=null;
		popDivDiffY=null;
		window.document.body.detachEvent("onmousemove",popDivMove);
		window.document.body.detachEvent("onmouseup",popDivMoveStop);
	 }
};
 function getInviteContent(){
    var content="";
  
 		content="&nbsp;<span id='inviteMessage' style='color:#000000;line-height:13px;FONT-SIZE: 9pt; FONT-FAMILY: Tahoma; word-break:break-all;word-wrap:break-word; '>";
 		//if(preferences["companyID"]=="800")content="&nbsp;<span id='inviteMessage' style='color:#FFFFFF;line-height:13px;FONT-SIZE: 9pt; FONT-FAMILY: Tahoma; word-break:break-all;word-wrap:break-word; '>";
 		content=content+URLDecode("您好！请问有什么可以帮助您的吗？请点击“接受”与我们交流。")+"<br/><br/>&nbsp;</span>";
 	
 	return content;
 };
 function URLDecode(Str){
  if(Str==null||Str=="")
    return "";
  var newStr="";
  function toCase(sStr){
    return sStr.toString(16).toUpperCase();
    }
  for(var i=0,ichar,len=Str.length;i<len;){
    if(Str.charAt(i)=="%"){
      ichar=Str.charAt(i+1);
      if(ichar.toLowerCase()=="e"){
        newStr+=String.fromCharCode((parseInt("0x"+Str.substr(i+1,2))-0xE0)*0x1000+(parseInt("0x"+Str.substr(i+4,2))-0x80)*0x40+parseInt("0x"+Str.substr(i+7,2))-0x80);
        i+=9;
        }
      else if(ichar.toLowerCase()=="c"||ichar.toLowerCase()=="d"){
        newStr+=String.fromCharCode((parseInt("0x"+Str.substr(i+1,2))-0xC0)*0x40+parseInt("0x"+Str.substr(i+4,2))-0x80);
        i+=6;
        }
      else{
        newStr+=String.fromCharCode(parseInt("0x"+Str.substr(i+1,2)));
        i+=3;
        }
      }
    else{
      newStr+=Str.charAt(i).replace(/\+/," ");
      i++;
      }
    }
  return newStr;
  };

