	window.onresize = xuguResizeDiv;
	window.onerror = function(){}
	var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
	var px = document.doctype?"px":0;
	var scrollwidth = navigator.userAgent.indexOf("Firefox")>0?16:0;
	var iframeheight = navigator.userAgent.indexOf("MSIE")>0?185-2:192-2;
	String.prototype.Trim  = function(){return this.replace(/^\s+|\s+$/g,"");}
	function xugu_collapse(obj){
		ct = document.getElementById('tab_c_iframe');
		if(ct.style.display=="none"){
			ct.style.display="";
			obj.src=obj.src.replace("b.gif","a.gif");
		} else {
			ct.style.display="none";
			obj.src=obj.src.replace("a.gif","b.gif");
		}
		xuguResizeDiv();
	}

	function xuguMsg()
	{
		try{
			divTop = parseInt(document.getElementById("exugu").style.top,10);
			divLeft = parseInt(document.getElementById("exugu").style.left,10);
			divHeight = parseInt(document.getElementById("exugu").offsetHeight,10);
			divWidth = parseInt(document.getElementById("exugu").offsetWidth,10);

			var scrollPosTop,scrollPosLeft,docWidth,docHeight;
			if (typeof window.pageYOffset != 'undefined') { 
				scrollPosTop = window.pageYOffset; 
				scrollPosLeft = window.pageXOffset; 
				docWidth = window.innerWidth; 
				docHeight = window.innerHeight; 
			} else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
				scrollPosTop = document.documentElement.scrollTop;
				scrollPosLeft = document.documentElement.scrollLeft;
				docWidth = document.documentElement.clientWidth;
				docHeight = document.documentElement.clientHeight;
			} else if (typeof document.body != 'undefined') { 
				scrollPosTop = document.body.scrollTop;
				scrollPosLeft = document.body.scrollLeft;
				docWidth = document.body.clientWidth;
				docHeight = document.body.clientHeight;
			}

			document.getElementById("exugu").style.top = parseInt(scrollPosTop,10) + docHeight + 10 + px;// divHeight
			document.getElementById("exugu").style.left = parseInt(scrollPosLeft,10) + docWidth - divWidth - scrollwidth + px;
			document.getElementById("exugu").style.visibility="visible";
			objTimer = window.setInterval("xugu_move_div()",10);
		}catch(e){}
	}

	function xuguResizeDiv()
	{
		i+=1;
		try{
			divHeight = parseInt(document.getElementById("exugu").offsetHeight,10);
			divWidth = parseInt(document.getElementById("exugu").offsetWidth,10);

			var scrollPosTop,scrollPosLeft,docWidth,docHeight; 
			if (typeof window.pageYOffset != 'undefined') { 
				scrollPosTop = window.pageYOffset; 
				scrollPosLeft = window.pageXOffset; 
				docWidth = window.innerWidth; 
				docHeight = window.innerHeight; 
			} else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
				scrollPosTop = document.documentElement.scrollTop;
				scrollPosLeft = document.documentElement.scrollLeft;
				docWidth = document.documentElement.clientWidth;
				docHeight = document.documentElement.clientHeight;
			} else if (typeof document.body != 'undefined') { 
				scrollPosTop = document.body.scrollTop;
				scrollPosLeft = document.body.scrollLeft;
				docWidth = document.body.clientWidth;
				docHeight = document.body.clientHeight;
			}

			document.getElementById("exugu").style.top = docHeight - divHeight + parseInt(scrollPosTop,10) + px;
			document.getElementById("exugu").style.left = docWidth - divWidth + parseInt(scrollPosLeft,10) - scrollwidth + px;
		}catch(e){}
	}

	function xugu_move_div()
	{

		var scrollPosTop,scrollPosLeft,docWidth,docHeight; 
		if (typeof window.pageYOffset != 'undefined') { 
			scrollPosTop = window.pageYOffset; 
			scrollPosLeft = window.pageXOffset; 
			docWidth = window.innerWidth; 
			docHeight = window.innerHeight; 
		} else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
			scrollPosTop = document.documentElement.scrollTop;
			scrollPosLeft = document.documentElement.scrollLeft;
			docWidth = document.documentElement.clientWidth;
			docHeight = document.documentElement.clientHeight;
		} else if (typeof document.body != 'undefined') { 
			scrollPosTop = document.body.scrollTop;
			scrollPosLeft = document.body.scrollLeft;
			docWidth = document.body.clientWidth;
			docHeight = document.body.clientHeight;
		}

		try{
			if(parseInt(document.getElementById("exugu").style.top,10) <= (docHeight - divHeight + parseInt(scrollPosTop,10)))
			{
				window.clearInterval(objTimer);objTimer = window.setInterval("xuguResizeDiv()",1);
			}
			divTop = parseInt(document.getElementById("exugu").style.top,10);
			document.getElementById("exugu").style.top = divTop - 1 + px;
		}catch(e){}
	}
	function xuguMessbox(shape,color,fen,myid){
		var styles='position:absolute;top:0px;left:0px;z-index:88888;visibility:hidden;';
		var copic='<img src="http://www.xugu.net/note/images/ico_'+color+'a.gif" align="absmiddle" class="ioc'+color+'" onClick="xugu_collapse(this)">';
		if(shape>1) window.onload = xuguMsg;
		else {styles='';copic=''}
		var s;
		if(shape==2) {
			s='<div id=exugu style="Z-INDEX:88888;LEFT:0px;POSITION:absolute;TOP:0px;VISIBILITY:hidden;">'
				+ '<table width="216" border="0" cellpadding="0" cellspacing="0" class="" id="tab_'+(color+3)+'" style="border:0px;">'
				+'<tr>'
				+'<td align="right"></td>'
				+'</tr>'
				+'  <tr>'
				+'    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">'
				+'        <tr>'
				+'          <td width="32" rowspan="2" valign="bottom"><img src="http://www.xugu.net/note/images/ico'+(color+1)+'.gif"></td>'
				+'          <td>&nbsp;</td>'
				+'        </tr>'
				+'        <tr>'
				+'          <td align=right style="font-size:12px; background:url(http://www.xugu.net/note/images/bg_'+color+'.gif);line-height:21px;height:21px;border-top:1px solid #808080;border-right:1px solid #808080;padding-right:6px;color:#FFFFFF;" onDblClick="xugu_collapse(this.firstChild.nextSibling)"><a href="http://www.61bay.com" target="_blank" style="text-decoration:none"><font color="#FFFFFF">儿童博客</font></a> <a href="http://www.61bay.com" target="_blank" style="text-decoration:none"><font color="#FFFFFF">中国幼教</font></a><img src="http://www.xugu.net/note/images/ico_'+color+'a.gif" align="absmiddle" class="ioc'+color+'" onClick="xugu_collapse(this)">'
				+'		  </td>'
				+'        </tr>'
				+'      </table>'
				+'	  </td>'
				+'    </tr></table>'

				+ '<iframe src="http://www.xugu.net/note/side.asp?fen='+fen+'&amp;id=' +myid+ '" width="216" height="' + iframeheight + '" frameborder="0" id="tab_c_iframe"></iframe>'
				+'<table width="216" border="0" cellspacing="0" cellpadding="3" height="69" style="border-left-width:1px;border-left-style:solid;border-left-color:#000;border-right-width:1px;border-right-style:solid;border-right-color:#000;border-top-width:0;border-bottom-width:1px; border-bottom-style:solid; border-bottom-color:#000000;"><tr><td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"><tr><td style="height:3px;"></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0" style="background:#E70010;"><tr><td width="31%" align="center" valign="middle"><img src="http://www.xugu.net/note/images/kefu.jpg" width="50" height="55" /></td><td><table width="100%" border="0" cellspacing="0" cellpadding="0"  style="font-size:12px;color:#FFFFFF;"><tr><td width="38%" height="22" valign="bottom">客服1</td><td width="62%" valign="bottom">客服2</td></tr><tr><td height="22" colspan="2"><a href="tencent://message/?uin=31584286&amp;Site=xugu.net&amp;Menu=yes"><img src="http://www.xugu.net/note/images/qq.gif" border="0"/></a>&nbsp;<a href="msnim:chat?contact=yuanam@hotmail.com"><img alt="点击给我发MSN消息" src="http://www.xugu.net/note/images/msn.jpg" border="0"/></a></td></tr><tr><td height="22" colspan="2" valign="top">电话:010-51668807</td></tr></table></td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"><tr><td style="height:3px;"></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0" style="background:#E70010;"></table></td></tr></table>'
				+'</div>';
		} 
		document.writeln(s);
	}
	
var getArgs=(function(){
    var sc=document.getElementsByTagName('script');
    var paramsArr=sc[sc.length-1].src.split('?')[1].split('&');
    var args={},argsStr=[],param,t,name,value;
    for(var i=0,len=paramsArr.length;i<len;i++){
            param=paramsArr[i].split('=');
            name=param[0],value=param[1];
            if(typeof args[name]=="undefined"){ //参数尚不存在
                args[name]=value;
            }else if(typeof args[name]=="string"){ //参数已经存在则保存为数组
                args[name]=[args[name]]
                args[name].push(value);
            }else{ //已经是数组的
                args[name].push(value);
            }
    }
    /*在实际应用中下面的showArg和args.toString可以删掉，这里只是为了测试函数getArgs返回的内容*/
    var showArg=function(x){   //转换不同数据的显示方式
        if(typeof(x)=="string"&&!/\d+/.test(x)) return "'"+x+"'";   //字符串
        if(x instanceof Array) return "["+x+"]" //数组
        return x;   //数字
    }
    //组装成json格式
    args.toString=function(){
        for(var i in args) argsStr.push(i+':'+showArg(args[i]));
        return '{'+argsStr.join(',')+'}';
    }
    return function(){return args;} //以json格式返回获取的所有参数
})();
 
 xuguMessbox(2,1,getArgs()["fen"],getArgs()["id"]);
