/* Ajax Construction Kit  */

/* Validation Toolkit Functions  */

function del_cookie(name) {
document.cookie = name +
'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
} 

function validateNonEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Please fill out field)");

}



function validateTitleEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Please enter the Title of the Employee.)");

}

function validatePhotoTitleEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Please enter the Title of the Photo.)");

}

function validateCliEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Please enter the Clients name.)");

}



function validateNameEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Please enter your name.)");

}



function validateLnameEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Please enter your last name.)");

}



function validateAddEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(A215 or 32922)");

}



function validateStreetEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Sunflower Ave.)");

}



function validateCityEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Santa Ana)");

}



function validateloginEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Enter your username Please.)");

}

function validatepassEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "(Enter your password Please.)");

}



function validatedesEmpty(inputControl, helpControl) {

  // See if the input value contains any text

  return validateRegEx(/.+/,

    inputControl.value, helpControl,

    "Please enter your message.");

}



function validateEmail(inputControl, helpControl) {

  // Then see if the input value is an email address

  return validateRegEx(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,

    inputControl.value, helpControl,

    "(johnDoe@ymail.com).");

}





function validateRegEx(regex, input, helpControl, helpMessage) {

  if (!regex.test(input)) {

    if (helpControl != null)

      helpControl.innerHTML = helpMessage;

    return false;

  }

  else {

    if (helpControl != null)

      helpControl.innerHTML = "";

    return true;

  }

}




