dom = (document.getElementById)? true : false;
ie4 = (document.all && !dom)? true : false;
nn4 = (document.layers)? true : false;


function OpenWindow( uri, width, height )
{
        var winName = 'win' + Math.floor( Math.random()*1000 )
        var realWidth = width ? width : 500
        var realHeight = height ? height : screen.height - 400

        var left = Math.round( (screen.width-realWidth)/2 )
        var top =  Math.round( (screen.height-realHeight)/2 ) - 35

        var winOptions = 'status=yes,menubar=no,toolbar=no'
        winOptions += ',resizable=yes,scrollbars=yes,location=no'
        winOptions += ',width='  + realWidth
        winOptions += ',height=' + realHeight
        winOptions += ',left='   + left
        winOptions += ',top='    + top

        var win = window.open( uri, winName, winOptions )
        win.focus()

        return win
}



function putElem(elemId) {
 if (dom)
        {
                document.getElementById(elemId).style.display = "block";
        }
  else if (ie4) 
        {
                document.all[elemId].style.display = "block";
        }
    else
    {
                alert('Ваш браузер не позволяет менять свойство display для элемента: '+elemId);
        }
}
function removeElem(elemId) {
if (dom){ document.getElementById(elemId).style.display = "none";}
 else if (ie4){document.all[elemId].style.display = "none";}
       else{alert('Ваш браузер не позволяет менять свойство display для элемента: '+elemId);}
}

function preloadImg(i) {
  var img = new Image();
  img.src = i;
  return img;
}

function chmode(name, mode) {
  if ( mode == 'on' ) add = '-on';
   else add = '';
  window.document.images[name].src = './i/'+name+add+'.gif';
}

function chmodeHref(name, mode) {
  if ( mode == 'on' ) add = '-on';
   else add = '';
  window.document.images[name].src = './i/href'+add+'.gif';
}
function chmodeHrefLI(name, mode) {
  if ( mode == 'on' ) add = '-on';
   else add = '';
  window.document.images[name].src = './i/href-li'+add+'.gif';
}


