
function _superDiv() {

    var isVisible=false;

    var cont=document.getElementById('container');
    var sd=document.getElementById('superdiv');
    var sdOp=document.getElementById('superdiv_op');
    var foot=document.getElementById('footer_container');
    var sdText=document.getElementById('sd_text');
    var sdBox=document.getElementById('sd_box');
    var sdClose=document.getElementById('sd_close');
    var sdToTop=document.getElementById('sd_totop');
    var sdContent=document.getElementById('sd_content');

    var oriw=document.getElementById('sd_box').style.width;
    
    var defW=576;
    var defH=10;
    var defT=205;
    var defWLoading=300;
    
    var loadingCaption;
    var loginCaption;
    var searchCaption;
    
    var sdOverflow;
    
    var animation=false;
    var contentPool='';

    this.showSuperdiv=function(w,h,t) {
	_superDiv.prototype.animation=true;
	if(cont.offsetHeight+foot.offsetHeight>=sdOp.offsetHeight) sdOp.style.height=parseInt(cont.offsetHeight+foot.offsetHeight)+'px';
	else {
	    cont.style.height=parseInt(sdOp.offsetHeight-foot.offsetHeight)+'px';
	    }
	if(t==-1) t=defT;
	sdBox.style.marginTop=t+'px';
	if(w==-1) w=defW;
	sdBox.style.width=w+'px';
	var checkH=sdText.offsetHeight+10;
	if((h==-1)||(h<checkH)) {
	    h=checkH;
	    }
	scroll(0,0);
	sdOverflow='visible';
	if(h+t>cont.offsetHeight+foot.offsetHeight-50) {
	    h=cont.offsetHeight+foot.offsetHeight-t-50;
	    sdOverflow='scroll';
	    }
	sdBox.style.width=oriw;
	sdOp.style.visibility='visible';
	sd.style.visibility='visible';
	sdBox.style.visibility='visible';
	sdClose.style.visibility='visible';
	sdToTop.style.visibility='visible';
	sdText.style.display='none';
	if(isVisible==false) {
	    sdBox.style.height=parseInt(defH+32)+'px';
	    sdContent.style.height=defH+'px';
	    }
	this.changeSize(w,40,h+32,40);
	isVisible=true;
    }

    this.hideSuperdiv=function() {
	isVisible=false;
	_superDiv.prototype.contentPool='';
	sdBox.style.width='0px';
	sdBox.style.height='0px';
	sdText.innerHTML='';
	sdText.style.visibility='hidden';
	sdText.style.overflow='visible';
	sdContent.style.overflow='visible';
	sdClose.style.visibility='hidden';
	sdToTop.style.visibility='hidden';
	sdContent.style.height='0px';
	sdBox.style.visibility='hidden';
	sd.style.visibility='hidden';
	sdOp.style.visibility='hidden';
	oriw='0px';
    }
    
    this.changeSize=function(destwidth,wstep,destheight,hstep) {
	var curwidth=sdBox.offsetWidth-2;
	var curheight=sdBox.offsetHeight-2;
	if(curwidth!=destwidth) {
	    if(destwidth<curwidth) {
		curwidth-=wstep;
		curwidth=curwidth<destwidth?destwidth:curwidth;
		}
	    else {
		curwidth+=wstep;
		curwidth=curwidth>destwidth?destwidth:curwidth;
		}
	    sdBox.style.width=curwidth+'px';
	    setTimeout('daSuperDiv.changeSize('+destwidth+','+wstep+','+destheight+','+hstep+');',5);
	    }
	else {
	    oriw=curwidth+'px';
	    if(destheight<curheight) {
		curheight-=hstep;
		curheight=curheight<destheight?destheight:curheight;
		}
	    else {
		curheight+=hstep;
		curheight=curheight>destheight?destheight:curheight;
		}
	    var ch=12;
	    sdBox.style.height=parseInt(curheight)+'px';
	    sdContent.style.height=parseInt(curheight-32)+'px';
	    if(curheight!=destheight) {
		setTimeout('daSuperDiv.changeSize('+destwidth+','+wstep+','+destheight+','+hstep+');',5);
		}
	    else {
		_superDiv.prototype.animation=false;
		sdContent.style.overflow=sdOverflow;
		sdText.style.visibility='visible';
		sdText.style.display='block';
		}
	    }
    }

    this.setContent=function(content,align,dontshow) {
	if(this.animation==false) {
	    if(content=='contentPool') {
		if(this.contentPool.length>0) {
		    content=this.contentPool;
		    _superDiv.prototype.contentPool='';
		    }
		else {
		    return;
		    }
		}
	    sdText.style.visibility='hidden';
	    sdText.style.textAlign=align;
	    sdText.style.overflow='visible';
	    sdText.innerHTML=content;
	    if(dontshow!=true) {
		this.showSuperdiv(-1,-1,-1);
		}
	    }
	else {
	    _superDiv.prototype.contentPool=content;
	    setTimeout('daSuperDiv.setContent(\'contentPool\',\''+align+'\',\''+dontshow+'\');',1000);
	    }
    }
    
    this.showLoadingBar=function() {
	this.showProgressBar(this.loadingCaption);
    }
    
    this.showLoginBar=function() {
	this.showProgressBar(this.loginCaption);
    }

    this.showSearchBar=function() {
	this.showProgressBar(this.searchCaption);
    }

    this.showProgressBar=function(caption) {
	var content='<span class="ajax_loading">'+caption+'</span><br /><img src="images/loading_mini.gif" width="80" height="13" alt="loading" />';
	this.setContent(content,'center',true);
	this.showSuperdiv(defWLoading,-1,-1);
    }
    
}



