function $(id) {
  if      (document.layers)         return document.layers[id];         // NC 4
  else if (document.all)            return document.all[id];            // IE 4
  else if (document.getElementById) return document.getElementById(id); // DOM
  else                              return null;        
}

function sw(id, num) {
  var pan=$('sub'+id);
  if (num==null || num=='undefined') num=3;
  if (pan==null) return;
  if (pan.style.display!='none') {
    pan.style.display='none';
    $('plus'+id).src='pic/plus'+num+'.gif';
  } else {
    pan.style.display='';
    if (num>3) num=3;
    $('plus'+id).src='pic/minus'+num+'.gif';
  }
}

function spw(a) {
  //Если display: none, то не загрузится
  $('preview').style.position= 'absolute';
  $('preview').style.display='block';
  $('previewimg').src=a;
  $('preview').style.width=$('previewimg').width;
  $('preview').style.height=$('previewimg').height+20;
  $('preview').style.top=screen.height/2+'px';
  $('preview').style.left=screen.width/2+'px';
}

function spw2() {
   $('preview').style.position= 'absolute';
 if ($('previewimg').src!='') {
    $('preview').style.width=$('previewimg').width;
    $('preview').style.height=$('previewimg').height+20;

    $('preview').style.top=screen.height/2+'px';
    $('preview').style.left=screen.width/2+'px';
  }
}

