
window.onload=function(){showBox();}

function showBox(o){
    
	if (o==undefined) o=document.getElementById("rbbox");
	fixedPosition(o,0 ,0);
	o.style.height=(o.clientHeight+Math.ceil((440-o.clientHeight)*0.08))+"px";
	if (o.clientHeight<180) {setTimeout(function(){showBox(o)},50);}
}
i=0
function closeBox(o){
	if (o==undefined) o=document.getElementById("rbbox");
	var dy=Math.max(0,Math.floor((parseInt(o.style.height)-20)*0.9));
	o.style.height=dy+"px";
	if(o.clientHeight<=20){document.getElementById("rbbox").style.display='none';return;}
	setTimeout(function(){closeBox(o)},50);
}

var fixedPosition = function(element ,bottom ,right){
	element.style.display = "block";
	if (!window.XMLHttpRequest && window.ActiveXObject)
	{
		element.style.position = "absolute";
		fixedPosition.setGlobal();
	}
	else
	{
		element.style.position = "fixed";
	}
	element.style.bottom = bottom +"px";
	element.style.right = right +"px";
};

/*添加css规则*/
fixedPosition.addCSSRule = function(key ,value){
   var css = document.styleSheets[document.styleSheets.length-1];
	css.cssRules ? 
		 (css.insertRule(key +"{"+ value +"}", css.cssRules.length)) :
		 (css.addRule(key ,value));

};

/*标志特定公共规则是否存在*/
fixedPosition.inited = false;

/*设置特定公共规则*/
fixedPosition.setGlobal = function(){
	if (! fixedPosition.inited)
	{
		document.body.style.height = "100%";
		document.body.style.overflow = "auto";
		fixedPosition.addCSSRule("*html" ,"overflow-x:auto;overflow-y:hidden;");
		fixedPosition.inited = true;
	}
};
