/* $Id: client.js,v 1.5 2005/03/25 09:00:22 alex Exp $ */ function confirmLink(link) {     if (confirm('Вы уверены?')) {         link.href += '&confirmed=1';         return true;     }     return false; } function fixFloat(fld, sign) {     fld.value = parseFloat(fld.value.replace(',', '.'));     if (isNaN(fld.value) || (fld.value < 0)) {         fld.value = 0;     } else {         num = Math.pow(10, sign);         fld.value = Math.round(fld.value*num)/num;     } } function fixInteger(fld) {     fld.value = parseInt(fld.value);     if (isNaN(fld.value) || (fld.value < 0)) {         fld.value = 0;     } } /* Do browser work - disallow selecting disabled options; specially for fucking IE */ function checkSelect(fld) {     opt = fld.getElementsByTagName('option');     for (i=0; i<opt.length; i++) {         if (opt.item(i).selected && opt.item(i).getAttribute('disabled')) {             alert('Этот пункт неактивен, выберите другой');             return false;         }     }     return true; } function popup(url, w, h) {     x = parseInt((screen.width - w)/2);     y = parseInt((screen.height - h)/2);     window.open(url, 'popup', 'width='+w+',height='+h+',left='+x+',top='+y); } /* Hints and menus */ var curX; var curY; function monitor(e){     if (window.event) {         var c = document.getElementsByTagName((document.compatMode && document.compatMode == "CSS1Compat")?"html":"body")[0];         curX = window.event.clientX + c.scrollLeft;         curY = window.event.clientY + c.scrollTop;     } else {         curX = e.pageX;         curY = e.pageY;     } } document.onmousemove = monitor; function hintShow(id) {     h = document.getElementById(id);     if (!h) {return}     h.style.display = 'block';     h.style.left = curX + 5 + 'px';     h.style.top = curY + 5 + 'px'; } function hintHide(id) {     h = document.getElementById(id);     if (!h) {return}     h.style.display = 'none'; } var zi = 1; function menuShow(id, h) {     menuHideAll();     m = document.getElementById(id);     if (!m) {return}     if (h) {         l = 0;         if (document.all) {             l += Math.round((document.body.clientWidth-980)/2);         }         m.style.left = h.offsetLeft + l + 'px';         m.style.top = 80 + 'px';     } else {         m.style.left = curX + 'px';         m.style.top = curY + 10 + 'px';     }     m.style.zIndex = zi++;     m.style.display = 'block';     setTimeout("menuHide('"+id+"')", 500); } function menuHide(id) {     m = document.getElementById(id);     if (!m) {return}     if (curX < m.offsetLeft || curX > m.offsetLeft+m.offsetWidth || curY < m.offsetTop-20 || curY > m.offsetTop+m.offsetHeight) {         m.style.display = 'none';     } else {         setTimeout("menuHide('"+id+"')", 500);     } } function menuHideAll() {     m = document.getElementsByTagName('div');     for (var i=0; i<m.length; i++) {         d = m.item(i);         id = d.getAttribute('id');         if (!id || (id.indexOf('dropm') == -1)) {continue}         d.style.display = 'none';     } }