function CaricaFoto(img)
{
  foto1= new Image();
  foto1.src=(img);
  Control(img, foto1);
}

function Control(img, foto1)
{
  if((foto1.width!=0)&&(foto1.height!=0))
  {
    viewPicture(img, foto1);
  }
  else
  {
    func="Control('"+img+"')";
    interv=setTimeout(func,20);
  }
}

function viewPicture(img, foto1)
{
  var picleft, pictop;

  picwidth=foto1.width+6;
  picheight=foto1.height+20;

  if(navigator.appName == "Microsoft Internet Explorer")
  {
    picleft = ((window.screen.availWidth - picwidth) / 2);
    pictop = ((window.screen.availHeight - picheight) / 2);
  }
  else
  {
    picleft = (((window.outerWidth - picwidth) / 2) - pageXOffset);
    pictop = (((window.outerHeight - picheight) / 2) - pageYOffset);
  }

  winprops="width="+picwidth+",height="+picheight+",left="+picleft+",top="+pictop+",titlebar=0";
  newWindow=window.showModalDialog(img, img, "dialogHeight: "+picheight+"px; dialogWidth: "+picwidth+"px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scroll: No;");
}

function DoSearchVehicles()
{
  document.vehiclesearch.LSEARCH.value = 1;
  document.vehiclesearch.submit();
  return null;
}

function MerkSubmit()
{
  document.vehiclesearch.SSYSKEY_TYP.value = "";
  document.vehiclesearch.submit();
  return null;
}

function ShowDetail(psSysKeyWkt)
{
  document.vehiclesearch.SSYSKEY_WKT.value=psSysKeyWkt;
  document.vehiclesearch.action = 'vehicledetail.php';
  document.vehiclesearch.submit();
  return null;
}

function ReadjustTable(iHeight)
{
  AnElem = document.getElementById('tablediv');
  if (AnElem != null)
  {
    AnElem.style.height = (document.body.clientHeight - iHeight);
  }
}

