function getObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}

function displayList(){    
  	    var h = getObject('menu').offsetHeight;  
	      var max_h = 155;
	      var anim = function(){			
				    h += 50; 
				    if(h >= max_h){ 
		            getObject('menu').style.height = "155px"; 
		            if(tt){window.clearInterval(tt);} 
				    }
				    else{ 
                getObject('menu').style.display="block";
                getObject('menu').style.height = h + "px";
				    }
		    }
		   	
			  var tt = window.setInterval(anim,2);

}

function hiddenList(){
       var h = getObject('menu').offsetHeight; 
		   var anim = function(){
			     h -= 50;
			     if(h <= 5){
	             getObject('menu').style.display="none"; 
		           if(tt){window.clearInterval(tt);}
		       }
		       else{
		           getObject('menu').style.height = h + "px";
		       }
		   }
		     
		   var tt = window.setInterval(anim,2); 
}

var fixedPosition = function(element ,bottom ,right){
	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;
	}
};

