function validatesngljnydetails()
 {
//------------------------------------------------------------------------------------  
  if (!(validatesngljnyvtypegroup())){return false;}
//------------------------------------------------------------------------------------ 
  if (!(validatesngljnyjtypegroup())){return false;}
//------------------------------------------------------------------------------------ 
  if (!(validatesngljnyjadressgroup())){return false;}
//------------------------------------------------------------------------------------  
  return true;
 }
//====================================================================================
function validatesngljnyvtypegroup()
 {
  var whichjourney = "Single Journey Details:\n\n";
  var pudat_alertstr = "";
  pudat_alertstr = pudat_alertstr +  "Please select a valid date and time.\n\n";
  pudat_alertstr = pudat_alertstr +  "The earlist pickup date & time allowed is\n";
  pudat_alertstr = pudat_alertstr +  "the date and time now plus 30 minutes*";
//------------------------------------------------------------------------------------ 
  if (document.getElementById('sngljny_vehicletype').value == "" )
   {
	alert( whichjourney+"Please select vehicle type." );
	document.getElementById('sngljny_vehicletype').focus();
	return false;
   }
//------------------------------------------------------------------------------------ 
  if (document.getElementById('sngljny_npassengers').value == "" )
   {
	alert( whichjourney+"Please specify the number of passengers." );
	document.getElementById('sngljny_npassengers').focus();
	return false;
   }
//------------------------------------------------------------------------------------ 
  if(document.getElementById("sngljny_pickup_date").value == "")
   {
	alert(whichjourney+"Please select a pickup date.");	
	document.getElementById("sngljny_pickup_date").focus();
	return false
   }
//--------------------------------------------------------------------------------
  if( document.getElementById('sngljny_pickup_hours').value == "" )
   {
	alert(whichjourney+ "Please specify the pickup hour." );
	document.getElementById('sngljny_pickup_hours').focus();
	return false;
   }
//--------------------------------------------------------------------------------
  if( document.getElementById('sngljny_pickup_mins').value == "" )
   {
    alert(whichjourney+"Please specify the pickup minutes." );
	document.getElementById('sngljny_pickup_mins').focus();
	return false;
   }
//--------------------------------------------------------------------------------
  if (!(validatejourneyschedulepublic('sngljny_pickup_date','sngljny_pickup_hours','sngljny_pickup_mins')))
   {
	alert(whichjourney+pudat_alertstr);
	document.getElementById("sngljny_pickup_date").focus();
	return false;		 
   }
//------------------------------------------------------------------------------------  
  return true;
 }
//====================================================================================
function validatesngljnyjtypegroup()
 {
  var whichjourney = "Single Journey Details:\n\n";
  var insertstr = "";
  var locationtype = new Array();
  var deparrstr = '';
//------------------------------------------------------------------------------------ 
  if( document.getElementById('sngljny_type').value == "" )
   {
	alert( whichjourney+"Please select a journey type." );
	document.getElementById('sngljny_type').focus();
	return false;
   }
//------------------------------------------------------------------------------------ 
  if( document.getElementById('sngljny_location').value == "" )
   {
	var jt = document.getElementById('sngljny_type').value;
	var jt_parts = jt.split(" ");
	jt_parts[0] = jt_parts[0].trim();
	jt_parts[0] = jt_parts[0].toUpperCase();
    switch (jt_parts[0])
	 {
	  case 'TO' : insertstr = "Drop Off";
	                 break;
	  case 'FROM' : insertstr = "Pickup";
	                 break;
	  default   : insertstr = "";
	                 break;
	 }
	alert(whichjourney+ "Please select a "+insertstr+" location." );
	document.getElementById('sngljny_location').focus();
	return false;
   }
//------------------------------------------------------------------------------------ 
  if(!( document.getElementById('sngljny_location').value == "" ))
   {
	var location = document.getElementById('sngljny_location').value;
    var locationtype  = 0;
    var testforloctype  = 0;
	var errormsg ='';
    var jt = document.getElementById('sngljny_type').value;
	var jt_parts = jt.split(" ");
	jt_parts[1] = jt_parts[1].trim();
	jt_parts[1] = jt_parts[1].toUpperCase();
    switch (jt_parts[1])
	 {
	  case "STATION" : testforloctype = 1;
	                   break;
	  case "AIRPORT" : testforloctype = 2;
	                   break;
      case "DOCK"    : testforloctype = 3;
	                   break;

	 }

	if (testforloctype>0)
	 {
	  locationtype = getlocationtype(location);
	  if (!(locationtype==testforloctype) && (locationtype < 4) )
	   {
		jt_parts[0] = jt_parts[0].trim();
	    jt_parts[0] = jt_parts[0].toUpperCase();
		switch (jt_parts[0])
	     {
	      case 'TO'   : insertstr = "Drop Off";
	                    break;
	      case 'FROM' : insertstr = "Pickup";
	                    break;
	      default     : insertstr = "";
	                    break;
	     }
		switch (locationtype)
	     {
	      case 1 : locationstr = "a station";
	                    break;
	      case 2 : locationstr = "an airport";
	                    break;
	      case 3 : locationstr = "a dock";
	                    break;
	      default : insertstr = "";
	                    break;
	     }
		
		errormsg = 'The Journey Type selected is '+jt+', ';
		errormsg = errormsg+'the '+insertstr+' Location selected is '+locationstr+'.\n\n';
		errormsg = errormsg+'Please correct the Journey Type or the ' +insertstr+' Location.';
		alert(whichjourney+errormsg);
	    document.getElementById('sngljny_location').focus();
	    return false;
	   }
	 }
   }
//------------------------------------------------------------------------------------ 
  if( document.getElementById('sngljny_train_number').value == "" )
   {
	var jt = document.getElementById('sngljny_type').value;
	var jt_parts = jt.split(" ");
	jt_parts[1] = jt_parts[1].trim();
	jt_parts[1] = jt_parts[1].toUpperCase();
	switch (jt_parts[1])
	 {
	  case "DOCK"  : alert(whichjourney+"Please enter a Ship name.");
	                 document.getElementById('sngljny_train_number').focus();
	                 return false;
	                 break;
	  //case "STATION" : insertstr = "Train details";
	                    //break;
	  //case "AIRPORT" : insertstr = "a Flight number";
	                    //break;
	 }
   }
//--------------------------------------------------------------------------------
   locationtype = document.getElementById('sngljny_type').value.split(" ");
   locationtype[0] = locationtype[0].toUpperCase();
   locationtype[0] = locationtype[0].trim();
   locationtype[1] = locationtype[1].toUpperCase();
   locationtype[1] = locationtype[1].trim();
   switch (locationtype[0])
    {
     case "FROM" : deparrstr = 'Arrival Time';
	               break;
     case "TO"   : deparrstr = 'Departure Time';
	               break;
     default     : deparrstr = 'Flight Time';
	               break;
	}
   if ((document.getElementById('sngljny_deparr_hours').value == "") && (locationtype[1] == "AIRPORT"))
    {
 	 alert(whichjourney+ "Please specify the Flight " + deparrstr + " hours." );
	 document.getElementById('sngljny_deparr_hours').focus();
	 return false;
    }
//--------------------------------------------------------------------------------
   if ((document.getElementById('sngljny_deparr_mins').value == "")  && (locationtype[1] == "AIRPORT"))
    {
     alert(whichjourney+"Please specify the Flight " + deparrstr + " minutes." );
 	 document.getElementById('sngljny_deparr_mins').focus();
	 return false;
    }
//------------------------------------------------------------------------------------  
  return true;
 }
//====================================================================================
function validatesngljnyjadressgroup()
 {
  var whichjourney = "Single Journey Details:\n\n";
  var jt = document.getElementById('sngljny_type').value;
  var jt_parts = jt.split(" ");
  jt_parts[0] = jt_parts[0].trim();
  jt_parts[0] = jt_parts[0].toUpperCase();
  switch (jt_parts[0])
   {
	case 'TO'   : insertstr = "Pickup";
	               break;
	case 'FROM' : insertstr = "Drop Off";
	               break;
	default     : insertstr = "";
	               break;
   }
//------------------------------------------------------------------------------------  
  if (( document.getElementById('sngljny_address_line_1').value == "") && (document.getElementById('sngljny_address_line_2').value == "" ))
   {
	alert(whichjourney+"Please enter the first line of the "+insertstr+" address." );
	document.getElementById('sngljny_address_line_1').focus();
	return false;
   }
//------------------------------------------------------------------------------------  
//if( document.getElementById('sngljny_address_line_2').value == "" )
// {
//alert(whichjourney+"Please enter a "+insertstr+" address" );
//document.getElementById('sngljny_address_line_2').focus();
//	return false;
//   }
//------------------------------------------------------------------------------------  
  if( document.getElementById('sngljny_address_district').value == "" )
   {
	alert(whichjourney+"Please enter a "+insertstr+" district.");
	document.getElementById('sngljny_address_district').focus();
	return false;
   }
//------------------------------------------------------------------------------------  
  if( document.getElementById('sngljny_address_postcode').value == "" )
   {
	alert(whichjourney+"Please enter a "+insertstr+" postcode" );
	document.getElementById('sngljny_address_postcode').focus();
	return false;
   }
//------------------------------------------------------------------------------------  
  return true;
 }
//====================================================================================

