
    function MiniBrowser(layertype, uN, uW, uH) {
      // Properties:
      this.titleHeight = 20;
      this.mainMargin = 3;
      this.shadowleftMargin = 3;
      this.shadowtopMargin = 3;
      this.titleColor = '#808080';
      this.titleBgColor = '#99cc00';
      this.mainBgColor = '#99cc00';
      this.eMain = document.getElementById('idMB'+uN);
      this.eShadow1 = document.getElementById('idMBShadow1_'+uN);
      this.eShadow2 = document.getElementById('idMBShadow2_'+uN);
      if (layertype == 1)
      {
          this.ebgLayer = document.getElementById('idMBbgLayer_a'+uN);
      }
      else
      {
          this.ebgLayer = document.getElementById('idMBbgLayer_b'+uN);
      }
      this.eTitle = document.getElementById('idMBT'+uN);
      this.eClose = document.getElementById('idMBTClose'+uN);
      this.eIContainer = document.getElementById('idMBC'+uN);
      var oIframe = document.getElementById('idMBF'+uN);
      
      if (oIframe && oIframe.contentWindow) // ie6 and Moz
        this.eIframe = oIframe.contentWindow;
      else
        this.eIframe = document.frames['idMBF'+uN]; // ie5
        
      this.replace = function(url) {
      this.eIframe.location.replace(url);
      }
      with (this.eMain.cbe) {
        background(this.mainBgColor);
        resizeTo(uW+(2*this.mainMargin), uH+this.titleHeight+(2*this.mainMargin));
        moveTo(-1000,-1000);
      }
      with (this.eShadow1.cbe) {
        moveTo(-1000,-1000);
      }
      with (this.eShadow2.cbe) {
        moveTo(-1000,-1000);
      }
      with (this.ebgLayer.cbe) {
        moveTo(0,0);
      }
      with (this.eTitle.cbe) {
        color(this.titleColor);
        background(this.titleBgColor);
        resizeTo(uW, this.titleHeight);
        moveTo(this.mainMargin, this.mainMargin);
        addEventListener('dragStart', mbDragStartListener, false);
        addEventListener('drag', mbDragListener, false);
        addEventListener('dragEnd', mbDragEndListener, false);
      }
      with (this.eClose.cbe) {
        moveTo(this.mainMargin + uW - 30, this.mainMargin);
      }
      with (this.eIContainer.cbe) {
        resizeTo(uW, uH);
        moveTo(this.eTitle.cbe.left(), this.eTitle.cbe.top()+this.eTitle.cbe.height());
      }
    }
    
    function mbDragStartListener(e) {
      bln_movefix = 1;
      mb1.eIContainer.cbe.hide();
    }

    function mbDragListener(e,shW) {
    
    if (bln_movefix == 1) {
          mb1.eMain.cbe.moveBy(e.dx, e.dy);  
          mb1.eShadow1.cbe.moveBy(e.dx, e.dy);  
          mb1.eShadow2.cbe.moveBy(e.dx, e.dy);  
          }
    } 
    function mbDragEndListener(e) {
      bln_movefix = 0;
      mb1.eIContainer.cbe.show();
    }
    function dragfix() {
      if (cbeDragObj)
      {
          document.cbe.removeEventListener('mousemove', cbeDragEvent, cbeDragObj.ondragCapture);
          document.cbe.removeEventListener('mouseup', cbeDragEndEvent, false);
          cbeDragEndEvent(mb1);
      }
    }

    function MBLink(blnLayer,strurl,strtitle,uW,uH)
    {
      int_scrollto_y = document.body.scrollTop;
      window.mb1 = new MiniBrowser(blnLayer,0, uW, uH);
      mb1.replace(strurl);
      mb1.eMain.cbe.resizeTo(uW+(2*mb1.mainMargin), uH+mb1.titleHeight+(2*mb1.mainMargin));
      mb1.eShadow1.cbe.resizeTo(mb1.shadowleftMargin, uH+mb1.titleHeight+(2*mb1.mainMargin));
      mb1.eShadow2.cbe.resizeTo(uW+(2*mb1.mainMargin)-mb1.shadowleftMargin, mb1.shadowleftMargin);
      mb1.eTitle.cbe.resizeTo(uW-30, mb1.titleHeight);
      mb1.eClose.cbe.moveTo(uW-15,3);
      mb1.eIContainer.cbe.resizeTo(uW, uH);
      document.getElementById('idMBF0').width = uW;
      document.getElementById('idMBF0').height = uH;
      
      mb1.eMain.cbe.moveTo((document.body.clientWidth/2)-(uW/2), document.body.scrollTop + (document.body.clientHeight/2)-(uH/2));
      mb1.eShadow1.cbe.moveTo((document.body.clientWidth/2)-(uW/2)+mb1.eMain.cbe.width(), mb1.shadowleftMargin+ document.body.scrollTop + (document.body.clientHeight/2)-(uH/2));
      mb1.eShadow2.cbe.moveTo((document.body.clientWidth/2)-(uW/2)+mb1.shadowleftMargin, mb1.eMain.cbe.height()+ document.body.scrollTop + (document.body.clientHeight/2)-(uH/2));

      if (blnLayer > 0) {
          mb1.ebgLayer.cbe.moveTo(0,0);
//          alert(int_fillup_layerscroll);
          mb1.ebgLayer.cbe.resizeTo(document.body.scrollWidth , document.body.scrollHeight);
          mb1.ebgLayer.cbe.show();
          bln_overflowhidden = 1;
          window.scrolling = 'none';
//          mb1.ebgLayer.style.overflow = 'hidden';
      }
      else
      {
          mb1.ebgLayer.cbe.hide();
      }

      window.scroll(0,int_scrollto_y);      
      mb1.eMain.cbe.show();
      mb1.eShadow1.cbe.show();
      mb1.eShadow2.cbe.show();
      mb1.eTitle.cbe.show();
      mb1.eClose.cbe.show();
      mb1.eIContainer.cbe.show();
      
      document.getElementById('setic_title').innerHTML = strtitle;
      document.getElementById('idMB0').style.visibility = 'visible';
    }

    function MBclose()
    {
     int_scrollto_y = document.body.scrollTop;
     mb1.ebgLayer.cbe.resizeTo(1,1);
     mb1.ebgLayer.cbe.hide();
     mb1.eShadow1.cbe.hide();
     mb1.eShadow2.cbe.hide();
     mb1.eMain.cbe.hide();
     mb1.eTitle.cbe.hide();
     mb1.eClose.cbe.hide();
     mb1.eIContainer.cbe.hide();
     mb1.replace('index.asp?gic=loading');
     document.getElementById('idMB0').style.visibility='hidden';
     window.mb1 = '';
     window.scrolling = 'auto';
//     mb1.ebgLayer.style.overflow = 'visible';
     
     window.scroll(0,int_scrollto_y);

    }

    function roundNumber(intnumber,intlength)
    {
      return Math.round(intnumber * Math.pow(10,intlength)) / Math.pow(10,intlength);     
    }
      
    function open_popup(strtype,url,title,intx,inty)
    {
        if (strtype == 'image')
        {
            var img = new Image();
            img.src = url;

            popup = window.open('index.asp?display=popup&displaytype='+ strtype +'&file='+url+'&title='+title, strtype +'popup', 'status=no,width='+ img.width +',height='+ img.height +',scrollbars=no');            
        }
        else
        {
            intx = 320;
            inty = 310; 

//            if (intx + inty == 0)
//            {
//            }
            popup = window.open('index.asp?display=popup&displaytype='+ strtype +'&file='+url+'&title='+title, strtype +'popup', 'status=no,width='+ intx +',height='+ inty +',scrollbars=no');
        }
 //       popup.focus();
    }

    function resize_popup()
    {
        //disabled. cuz firefox now prohbites window-resizing. moved to creating-function
 //       this.focus();
    }

    function textCounter(field, countfield, maxlimit) 
    {
        if (field.value.length > maxlimit)
            field.value = field.value.substring(0, maxlimit);
        else 
        {
            countfield.value = maxlimit - field.value.length;
        }
    }
    
    
