﻿var DSQ;//定时器
var Expand="d1";//当前为展开项的ID
var Pucker="d2";//将被展开项的ID;
var Zdsd=60;//菜单折叠速度，单位为1/1000秒
var Cbj=60;//折叠步进长度

function CQMenu(obj){
	 Pucker=obj;
	 if(Expand!=obj){
	  var d3=document.getElementById(Expand);
	  d3.style.visibility="hidden";
	 }
	 
	 DSQ=setInterval("PUCKER()",Zdsd);
}

function fillInner(){


	var d4=document.getElementById(Pucker);
	d4.style.visibility="visible";	
}

// 步进式折叠
function PUCKER(){
	try{
	    var d1=document.getElementById(Expand);
    	
	    var d2=document.getElementById(Pucker);
    		
    		
		    // 如果折叠完成
		    if(parseInt(d1.style.height)==0){
    			
			    clearInterval(DSQ);
    			
			    //d2.innerHTML="";//清除旧展开项中的内容
			    //d1.style.visibility="hidden";
    			
			    //d1.innerHTML="";
			    Expand=Pucker;//将被折叠项变成展开项
			    fillInner();//填充新展开项的内容
    			
    				
			    return;
		    }
		    if(isIE()){
			    //展开将被展开的项	
			    d1.style.height=parseInt(d1.style.height)-Cbj;
			    //当前展开的项，将被折叠
			    d2.style.height=parseInt(d2.style.height)+Cbj;
		    }
		    else
		    {
			    //展开将被展开的项	
			    d1.style.height=parseInt(d1.style.height)-Cbj+"px";
			    //当前展开的项，将被折叠
			    d2.style.height=parseInt(d2.style.height)+Cbj+"px";			
		    }
	}catch(e){}
}


function isIE(){
	var re=false;
	var ua=window.navigator.userAgent.toLowerCase();
	if(ua.indexOf("msie")!=-1) 
	{ 
		re=true;
	}
	return re;
}