function panelAnimate(divId,radius, circleimgurl)
{
    var div = document.getElementById(divId);
    var divs = new Array();
    var children = div.getElementsByTagName('*');

    this.createRoundCorners = function() {
        
        if (div.currentStyle)
            var col = div.currentStyle['backgroundColor'];
        else if (window.getComputedStyle)
            var col = document.defaultView.getComputedStyle(div, null).getPropertyValue('background-color');

        if (col.length == 4) col = col.substring(0, 2) + col.substring(1, 2) +
        col.substring(2, 3) + col.substring(2, 3) +
        col.substring(3, 4) + col.substring(3, 4);
	
        for (var c = 0; c < 4; c++) {
            if(document.getElementById(div.id+'corner'+c)!=null)
                div.removeChild(document.getElementById(div.id+'corner'+c));
            divs[c] = document.createElement('img');
	    divs[c].id = div.id+'corner'+c;
            divs[c].style.position = 'absolute';
            divs[c].src = circleimgurl;
            divs[c].style.width = (radius * 2) + 'px';
            divs[c].style.height = (radius * 2) + 'px';
            divs[c].style.zIndex = -1;
            //corners[c].style.filter = 'mask(color=#ffffff) mask(color=' + col + ')';
            div.appendChild(divs[c]);
        }

        divs[0].style.left = Math.round(-(radius * 0.75)) + 'px';
        divs[0].style.top = Math.round(-(radius * 0.75)) + 'px';
        divs[1].style.left = Math.round(-(radius * 0.75)) + 'px';
        divs[1].style.top = Math.round((div.offsetHeight - (radius * 1.25))) + 'px';
        divs[2].style.left = Math.round((div.offsetWidth - (radius * 1.25))) + 'px';
        divs[2].style.top = Math.round(-(radius * 0.75)) + 'px';
        divs[3].style.left = Math.round((div.offsetWidth - (radius * 1.25))) + 'px';
        divs[3].style.top = Math.round((div.offsetHeight - (radius * 1.25))) + 'px';

        // top-bottom padding
        if(document.getElementById(div.id+'side'+4)!=null)
            div.removeChild(document.getElementById(div.id+'side'+4));
        divs[4] = document.createElement('div');
	divs[4].id = div.id+'side'+4;
        divs[4].style.position = 'absolute';
        divs[4].style.backgroundColor = col;
        divs[4].style.width = div.offsetWidth + 'px';
        divs[4].style.height = Math.round(div.offsetHeight + (radius * 1.5)) + 'px';
        divs[4].style.left = '0px';
        divs[4].style.top = Math.round(-(radius * 0.75)) + 'px';
        divs[4].style.zIndex = -1;
        div.appendChild(divs[4]);

        // left-right padding
        if(document.getElementById(div.id+'side'+5)!=null)
            div.removeChild(document.getElementById(div.id+'side'+5));
        divs[5] = document.createElement('div');
        divs[5].id = div.id+'side'+5;
        divs[5].style.position = 'absolute';
        divs[5].style.backgroundColor = col;
        divs[5].style.width = Math.round(div.offsetWidth + (radius * 1.5)) + 'px';
        divs[5].style.height = div.offsetHeight + 'px';
        divs[5].style.left = Math.round(-(radius * 0.75)) + 'px';
        divs[5].style.top = '0px';
        divs[5].style.zIndex = -1;
        div.appendChild(divs[5]);

    }
    this.vertFlipIn = function() {

        var divHeight = div.offsetHeight;
        var divTop = div.offsetTop;
        div.style.height = '0px'
        var divsHeight = new Array();
        var divsTop = new Array();
        for (var i = 0; i < divs.length; i++) {
            divsHeight[i] = divs[i].offsetHeight;
            divsTop[i] = divs[i].offsetTop;
            divs[i].style.height = '0px'
        }

        var step = divHeight / 7;
        var t = window.setInterval(function() {		
            step = (step / 1.05);
            div.style.height = div.offsetHeight + step + 'px';
            div.style.top = Math.round(divTop + (divHeight / 2) - (div.offsetHeight / 2)) + 'px';
            div.style.visibility = 'visible';
           
            for(var j=0;j<children.length;j++){
		if(children.item(j).style){
                    if( children.item(j).id != 'ctryty' ){
                        var op = div.offsetHeight/divHeight;
                        if (document.all) {
                            if( op <0.8 ) children.item(j).style.visibility = 'hidden';
                            else children.item(j).style.visibility = 'visible';                       
                           //children.item(j).style.filter = 'alpha(opacity='+(100*op)+');';
                        }
                        else {
                            children.item(j).style.opacity = ((op>0.5)*op*2)-1;
                         }    
                    }
                } 
            }

            divs[0].style.height = Math.round(divsHeight[0] * div.offsetHeight / divHeight) + 'px';
            divs[0].style.top = Math.round(-(divs[0].offsetHeight * 0.25)) + 'px';

            divs[1].style.height = Math.round(divsHeight[1] * div.offsetHeight / divHeight) + 'px';
            divs[1].style.top = Math.round(div.offsetHeight - (divs[1].offsetHeight * 0.75)) + 'px';

            divs[2].style.height = Math.round(divsHeight[2] * div.offsetHeight / divHeight) + 'px';
            divs[2].style.top = Math.round(-(divs[2].offsetHeight * 0.25)) + 'px';

            divs[3].style.height = Math.round(divsHeight[3] * div.offsetHeight / divHeight) + 'px';
            divs[3].style.top = Math.round(div.offsetHeight - (divs[3].offsetHeight * 0.75)) + 'px';

            divs[4].style.height = Math.round(div.offsetHeight + (divs[0].offsetHeight * 0.5) )+ 'px';
            divs[4].style.top = Math.round(-(divs[0].offsetHeight * 0.25)) + 'px';

            divs[5].style.height = Math.round(div.offsetHeight-(divs[0].offsetHeight*0.5) )+ 'px';
            divs[5].style.top = Math.round( divs[0].offsetHeight*0.25 )+ 'px';

            if (div.offsetHeight >= divHeight) {
		window.clearInterval(t);
                div.style.height = divHeight + 'px';
                div.style.top = divTop + 'px';
                for (var i = 0; i < divs.length; i++) {
                    divs[i].style.height = divsHeight[i]+'px';
                    divs[i].style.top = divsTop[i]+'px';
                }
            }
        }, 100);
    }
}
