function CFreeze()
{    this.host = window.location.protocol+'//'+window.location.hostname;
    if (this.host[this.host.length-1]!='/') this.host += '/';
    this.color = '#AA99CC';
    this.data = {};

    this.unfreeze = function(id)
    {        if (id && this.data[id])
        {
            this.data[id].style.display = 'none';
        	this.toggleSelects(id,true);
        }
        else for (var i in this.data)
        {
            this.data[i].style.display = 'none';
        	this.toggleSelects(i,true);
        }
    };
    this.freeze = function(id,accepting)
    {
        var el = $(id);
        if (!el || el.tagName!='DIV') return;
        if (!this.data[id]) this.data[id] = this.create(el);       	this.data[id].style.background = !accepting ? this.color :
       	     this.color+" url('"+this.host+"images/load.gif') no-repeat center center";

        this.data[id].style.height = el.offsetHeight+"px";
        this.data[id].style.width = el.offsetWidth+"px";
        this.data[id].style.top = el.style.top;
        this.data[id].style.left = el.style.left;

       	this.data[id].style.display = 'block';
       	this.toggleSelects(id);
    };

    this.create = function(el)
    {        var f = el.parentNode.insertBefore($$('DIV'), el);
        f.style.display      = 'none';
        f.style.zIndex       = 999;
        f.style.position     = 'absolute';
        f.style.filter       = 'alpha(opacity=50)';
        f.style.MozOpacity   = 0.5;
        f.style.KhtmlOpacity = 0.5;
        f.style.opacity      = 0.5;
        return f;
    };

    this.toggleSelects = function(id,vis)
    {       	if (navigator.appVersion.indexOf("MSIE 6")!=-1)
        {
         	var els = $(id).getElementsByTagName('SELECT');
         	var len = els.length;
         	for(var i=0;i<len;i++) els[i].style.visibility = vis ? '' : 'hidden';
        }
    }

}

