function showVehicleImages(id)
{

var width = 800;
var height = 600;
var xpos = 0;
var ypos = 100;

   if (self.screen.width)
   {
   width = self.screen.width - 10;
   height = self.screen.height - 75;
   xpos = 0;
   ypos = 0;
   }

var the_window = window.open('vehicle_images_view.php?id=' + id,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,left=' + xpos + ',top=' + ypos + ',screenX=' + xpos + ',screenY=' + ypos + ',width=' + width + ',height=' + height);

}





function showVehicleEnlargement(id, width, height)
{

var xpos = 0;

   if (self.screen.width)
   {
   xpos = (self.screen.width / 2) - (width / 2);
   }

var the_window = window.open('vehicle_enlargement.php?id=' + id,'','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,left=' + xpos + ',top=100,screenX=' + xpos + ',screenY=100,width=' + width + ',height=' + height);

}





function setImage(image_html, layerid)
{

   if (!document.getElementById && !document.all) return;

var domref;

   if (document.getElementById)
      domref = document.getElementById(layerid);
   else if (document.all)
      domref = document.all(layerid);

   if (image_html != '')
      domref.innerHTML = unescape(image_html);
   else
      domref.innerHTML = '';

}





function showFinanceCalculator(id)
{

var width = 420;
var height = 410;
var xpos = 0;

   if (self.screen.width)
   {
   xpos = (self.screen.width / 2) - (width / 2);
   }

var the_window = window.open('finance_calculator_options.php?id=' + id,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,left=' + xpos + ',top=100,screenX=' + xpos + ',screenY=100,width=' + width + ',height=' + height);

}





function checkUserInput(figure, defaultfigure, signed)
{

figure = parseFloat(figure);

   if (isNaN(figure)) figure = defaultfigure;
   if (signed == false) figure = Math.sqrt(figure*figure);

figure = Math.round(figure*100)/100;

   if (figure == Math.round(figure))
      figure += '.00';
   else if ((figure*10) == Math.round(figure*10))
      figure += '0';

return figure;
}





function validateCustomerDetails()
{

   if (!document.forms) return;

var error_msg = '';

   if (document.forms[0].elements[0].value == '') error_msg += 'Name\n';
   if (document.forms[0].elements[1].value == '') error_msg += 'Address\n';
   if (document.forms[0].elements[2].value == '') error_msg += 'Postcode\n';
   if (document.forms[0].elements[3].value == '') error_msg += 'Telephone\n';
   if (document.forms[0].elements[4].value == '') error_msg += 'Email\n';

   if (error_msg != '')
   {
   error_msg = 'Please complete the following fields:\n' + error_msg;
   alert(error_msg);
   return false;
   }

return true;
}





function showVanFinder()
{

var width = 420;
var height = 410;
var xpos = 0;

   if (self.screen.width)
   {
   xpos = (self.screen.width / 2) - (width / 2);
   }

var the_window = window.open('van_finder_options.php','','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,left=' + xpos + ',top=100,screenX=' + xpos + ',screenY=100,width=' + width + ',height=' + height);

}





function validateVanFinderOptions()
{

   if (!document.forms) return;

var error_msg = '';

   if (document.forms[0].elements[0][document.forms[0].elements[0].selectedIndex].value == '') error_msg += 'Van Make\n';
   if (document.forms[0].elements[1].value == '') error_msg += 'Van Model\n';
   if (document.forms[0].elements[2].value == 0) error_msg += 'Guide Price\n';

   if (error_msg != '')
   {
   error_msg = 'Please complete the following fields:\n' + error_msg;
   alert(error_msg);
   return false;
   }

return true;
}





function showDiv(div_id)
{

   if (document.getElementById && document.getElementById(div_id))
   {
   document.getElementById(div_id).style.display = 'block';
   }

}

function hideDiv(div_id)
{

   if (document.getElementById && document.getElementById(div_id))
   {
   document.getElementById(div_id).style.display = 'none';
   }

}

function toggleDiv(div_id)
{

   if (document.getElementById && document.getElementById(div_id))
   {
   var div_ref = document.getElementById(div_id).style;

      if (div_ref.display == 'none')
      {
      div_ref.display = 'block';
      }
      else if (div_ref.display == 'block' || div_ref.display == '')
      {
      div_ref.display = 'none';
      }

   }

}





function hideWindowStatus()
{
window.status='';
return true;
}