function picpopup(url, x, y, name){
    wwpicpop=window.open(url,'picpopup','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes, width='+(x+15)+', height='+(y+0)+', resizable=no');
    top.window.wwpicpop.document.write ('<html><head><title>'+name+'</title></head>'+'<body leftmargin=0 topmargin=1 rightmargin=1 bottommargin=1 marginwidth=1 marginheight=1 onLoad="focus();">'+'<a title="close this window" href="javascript:window.close();"><img src="'+url+'" alt="" hspace=0 vspace=0 width="'+x+'" align="middle" border=0></a></body></html>')
    top.window.wwpicpop.document.close();
}

var popupWin;

function popup(url){
    popupWin = window.open(url,'popup','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,width=500,height=450,resizable=yes').focus();
}
function display(field, button, btnText) {
    var element = document.getElementById(field);
    if (element.style.display != 'block') {
        element.style.display = 'block';
        button.innerHTML = 'Скрыть ' + btnText;
    } else {
        element.style.display = 'none';
        button.innerHTML = 'Отобразить ' + btnText;
    }
}
function show(field) {
    var element = document.getElementById(field);
    element.style.display = 'block';
    return false;
}
function hide(field) {
    var element = document.getElementById(field);
    element.style.display = 'none';
    return false;
}

function disable(elem, _disable) {
    element = document.getElementById(elem);
    if(element) {
        element.className = (_disable) ? 'btnDisabled' : 'btnEnabled';
        element.disabled = _disable;
    }
}

function undel(msg) {
    return confirm('Вы действительно хотите удалить ' + msg + '?');
}

function preloadImages() {
  var d=document;
  var srcs=new Array('news2','catalog2','company2','shop2','contact2');
  if(d.images){
    d.imgArr=new Array();
    var i;
    for(i=0;i<srcs.length;i++){
      d.imgArr[i]=new Image();
      d.imgArr[i].src='images/'+srcs[i]+'.gif';
//      d.imgArr[i].onload=imgHandler;
    }
  }
}
function imgHandler(){
  alert('Loaded');
}
preloadImages();
