var dsk = {
 isLoading: 0,
 count: 0,
 xPos: 0,
 yPos: 0,
 init: function() {
  Event.observe(document, "mousemove", dsk.MouseMoved, false);
 },
 MouseMoved: function (e) {
  dsk.xPos = Event.pointerX(e);
  dsk.yPos = Event.pointerY(e);
  if(!dsk.isLoading) return;
  m = $('mouse_loading');

  m.style.left=(dsk.xPos+10)+"px";
  m.style.top=(dsk.yPos-26)+"px";
 },
 incLoading: function() {
  dsk.isLoading=1;
  dsk.count++;
  m = $('mouse_loading');
  m.style.left=(dsk.xPos+10)+"px";
  m.style.top=(dsk.yPos-26)+"px";
  m.style.display="block";
 },
 decLoading: function() {
  if(!this.count) return;
  this.count--;
  if(!this.count) {
   this.isLoading=0;
   $('mouse_loading').style.display="none";
  }
 }
};

function numf(a, b, c, d) {
 var b = (b == null) ? 2 : b;
 var c = (c == null) ? ',' : c;
 var d = (d == null) ? '.' : d;
 a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
 e = a + '';
 f = e.split('.');
 if (!f[0]) {
  f[0] = '0';
 }
 if (!f[1]) {
  f[1] = '';
 }
 if (f[1].length < b) {
  g = f[1];
  for (i=f[1].length + 1; i <= b; i++) {
   g += '0';
  }
  f[1] = g;
 }
 if(d != '' && f[0].length > 3) {
  h = f[0];
  f[0] = '';
  for(j = 3; j < h.length; j+=3) {
   i = h.slice(h.length - j, h.length - j + 3);
   f[0] = d + i +  f[0] + '';
  }
  j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
  f[0] = j + f[0];
 }
 c = (b <= 0) ? '' : c;
 return f[0] + c + f[1];
}