﻿var prox; 
    var proy; 
    var proxc; 
    var proyc; 
    function show(id,width,height){/*--打开--*/ 
        clearInterval(prox); 
        clearInterval(proy); 
        clearInterval(proxc); 
        clearInterval(proyc); 
        var o = document.getElementById(id); 
        o.style.display = "block"; 
        o.style.width = "1px"; 
        o.style.height = "1px";  
        prox = setInterval(function(){openx(o,width,height)},10); 
    }     
    function openx(o,width,height){/*--打开x--*/ 
        var cx = parseInt(o.style.width); 
        if(cx < width) 
        { 
            o.style.width = (cx + Math.ceil((width-cx)/5)) +"px"; 
        } 
        else 
        { 
            clearInterval(prox); 
            proy = setInterval(function(){openy(o,height)},10); 
        } 
    }     
    function openy(o,height){/*--打开y--*/     
        var cy = parseInt(o.style.height); 
        if(cy < height) 
        { 
            o.style.height = (cy + Math.ceil((height-cy)/5)) +"px"; 
        } 
        else 
        { 
            clearInterval(proy);             
        } 
    }     
    function close(id){/*--关闭--*/ 
        clearInterval(prox); 
        clearInterval(proy); 
        clearInterval(proxc); 
        clearInterval(proyc);         
        var o = document.getElementById(id); 
        if(o.style.display == "block") 
        { 
            proyc = setInterval(function(){closey(o)},10);             
        }         
    }     
    function closey(o){/*--打开y--*/     
        var cy = parseInt(o.style.height); 
        if(cy > 0) 
        { 
            o.style.height = (cy - Math.ceil(cy/5)) +"px"; 
        } 
        else 
        { 
            clearInterval(proyc);                 
            proxc = setInterval(function(){closex(o)},10); 
        } 
    }     
    function closex(o){/*--打开x--*/ 
        var cx = parseInt(o.style.width); 
        if(cx > 0) 
        { 
            o.style.width = (cx - Math.ceil(cx/5)) +"px"; 
        } 
        else 
        { 
            clearInterval(proxc); 
            o.style.display = "none"; 
        } 
    }         
     
 
 function getplace(obj,width,height)
 {
    var state = document.getElementById(obj).style.display;    
    if(state == "" || state == "none")
    {
        show(obj,width,height);
    }
    else
    {
        close(obj);
    }
 }
