Check for conflicting dates

Check for conflicting dates

I am trying to create a form that will double check whether or not a person is already scheduled for a shift that is in conflict with another shift that I would attempt to assign the person to. I.E. PersonA is assigned to Shift1 from 7/1/2013 to 7/7/2013. If I tried to schedule PersonA for ShiftB that is from 7/3/2013 to 7/10/2013, the application will tell me that those dates are unavailable.

on Validate
if (Shift[ID == input.Shift && Shift_Start_Date <= input.Assign_End_Date && Shift_End_Date == input.Assign_Start_Date].count() >0)
{
      alert "Dates unavailable";
      cancel submit;
}

When I save the script, the dot next to Validate does not turn green and if I move away from the script and come back, this script looks like this:

if (condition)
{
      alert <text>;
      cancel submit;
}

What is wrong and how can I fix it?