function checkFields(){
    if ($('#thename') && $('#thename').length > 0 && trimAll($('#thename').val()) == ''){
        alert('Your name is missing');
        $('#thename').focus();
        return false;
    }
    if ($('#surname') && $('#surname').length > 0 && trimAll($('#surname').val())==''){
        alert('Your surname is missing');
        $('#surname').focus();
        return false;
    }
    if ($('#company') && $('#company').length > 0 && trimAll($('#company').val())==''){
        alert('Company name is missing');
        $('#company').focus();
        return false;
    }
    if ($('#email') && $('#email').length > 0 && $('#email').val().indexOf('@')==-1){
       alert('Invalid email address');
       $('#email').focus();
       return false;
    }
    if ($('#postcode') && $('#postcode').length > 0 && trimAll($('#postcode').val())==''){
        alert('Postcode is missing');
        $('#postcode').focus();
        return false;
    }
    
    return true;

}

function trimAll(sString)
{
	while (sString.substring(0,1) == ' ')
	{
	   sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
	   sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function checkAllOtherfields(){
    if ($('#description1') && $('#description1').length > 0 && trimAll($('#description1').val())==''){
        alert('Description is missing');
        $('#description1').focus();
        return false;
    }
    if ($('#quantity1') && $('#quantity1').length > 0 && trimAll($('#quantity1').val())==''){
        alert('Quantity is missing');
        $('#quantity1').focus();
        return false;
    }
     if ($('#size1') && $('#size1').length > 0 && trimAll($('#size1').val())==''){
       alert('Size is missing');
       $('#size1').focus();
       return false;
    }
    if ($('#address') && $('#address').length > 0 && trimAll($('#address').val())==''){
        alert('Address is missing');
        $('#address').focus();
        return false;
    }
    if ($('#address2') && $('#address2').length > 0 && trimAll($('#address2').val())==''){
        alert('Address line 2 is missing');
        $('#address2').focus();
        return false;
    }
    if ($('#address3') && $('#address3').length > 0 && trimAll($('#address3').val())==''){
        alert('Address line 3 is missing');
        $('#address3').focus();
        return false;
    }
    if ($('#date') && $('#date').length > 0 && trimAll($('#date').val())==''){
        alert('Date is missing');
        $('#date').focus();
        return false;
    }
    if ($('#location') && $('#location').length > 0 && trimAll($('#location').val())==''){
        alert('Furniture location is missing');
        $('#location').focus();
        return false;
    }
    if ($('#lift_dimension') && $('#lift_dimension').length > 0 && trimAll($('#lift_dimension').val())==''){
        alert('Lift dimension is missing');
        $('#lift_dimension').focus();
        return false;
    }
    if ($('#parking') && $('#parking').length > 0 && trimAll($('#parking').val())==''){
        alert('Parking is missing');
        $('#parking').focus();
        return false;
    }

    return true;
}
