var waitbox_state = 0;
var WaitBox = function(msg,msg2)
{
    this.message = msg;
    this.subtext = msg2;
    
    this.gid = "waitbox"+Math.random();
    this.currentshadow = null;
    this.currentdiv = null;
    
    this._ge = function(id){ return document.getElementById(id); }
    this._gt = function(tag){ return document.getElementsByTagName(tag); }
    this._ce = function(tag){ return document.createElement(tag); }

    this.overflow = "auto";
    
    this.Show = function()
    {
	if(waitbox_state)return;
	waitbox_state = 1;
        var b = this._gt("body");
        var div = this._ce("div");
	
	b[0].style.overflow = 'hidden';
        
        div.ID = this.gid+"_shadow";
        div.className="waitboxshadow";
	    this.currentshadow = div;

        b[0].appendChild(div);

        div.ID = this.gid;
	    div = this._ce("div");
	    div.className = "waitbox";
        div.innerHTML = '<span class="waitboxtxt1">'+this.message+'</span><br /><span class="waitboxtxt2">'+this.subtext+'</span><br /><img src="content/img/cclogo.gif" />';
    
	    this.currentdiv = div;
        
        b[0].appendChild(div);
    }
    
    this.Hide = function()
    {
	try
	{
	        var b = this._gt("body");
		b[0].style.overflow = 'auto';
	        b[0].removeChild(this.currentdiv);        
	        b[0].removeChild(this.currentshadow);        
		waitbox_state = 0;
	}
	catch(e)
	{
	}
    }
}
