// JavaScript Document
function brochure_display_window(url) {
      window.open(url, "chev_data_legal", "width=590,height=380,scrollbars=no,resizable=no,screenX=250,screenY=250");
}	 
var writeWin = null;
function writeMini(fileName) {
  writeWin = window.open('','ImagePopup','top=0,left=0,width=590,height=370');
  source = fileName;
  var content = '<html><head><title></title></head>';
  content += '<body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">';
  content += '<img src="';
  content += source;
content +=  '"></body></html>';
  var wd = writeWin.document;
  wd.open();
  wd.write(content);
  wd.close();
}

function validate()
{
	var errorString = '';
	var error = 0
	
	if (!((document.frmRequest.chkBrochureType[0].checked) || (document.frmRequest.chkBrochureType[1].checked) || (document.frmRequest.chkBrochureType[2].checked) || (document.frmRequest.chkBrochureType[3].checked)))
	{
		errorString = errorString + 'You must select a brochure\n';
		error = 1;
	}
	if (document.frmRequest.firstname.value == '')
	{
		errorString = errorString + 'You must enter you first name\n';
		error = 1;
	}
	if (document.frmRequest.surname.value == '')
	{
		errorString = errorString + 'You must enter your surname\n';
		error = 1;
	}
	if (document.frmRequest.address1.value == '')
	{
		errorString = errorString + 'You must enter your address\n';
		error = 1;
	}
	if (document.frmRequest.towncity.value == '')
	{
		errorString = errorString + 'You must enter a town / city\n';
		error = 1;
	}
	if (document.frmRequest.postcode.value == '')
	{
		errorString = errorString + 'You must enter a postcode\n';
		error = 1;
	}
	if (document.frmRequest.email.value == '')
	{
		errorString = errorString + 'You must enter an email address\n';
		error = 1;
	}
	if (document.frmRequest.agree.checked == false)
	{
		errorString = errorString + 'You must agree to the terms and contitions\n';
		error = 1;
	}
	
	if (error > 0)
	{
		alert(errorString);
	}
	else
	{
		document.forms['frmRequest'].submit();
	}
}
