

//============================================================validate new section name

function ValidateDIR(theForm) {

	

if (theForm.newsection.value == "") {

  	alert("Please enter a new Album name.");

	theForm.newsection.focus();

	return (false);

  }

  //illegal characters---------------------------------------------

  var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";



for (var i = 0; i < theForm.newsection.value.length; i++) {

if (iChars.indexOf(theForm.newsection.value.charAt(i)) != -1) {

alert ("Your new Album name has illegal characters. \n !@#$%^&*()+=-[]\\\';,./{}|\":<>? are not allowed.\n Please remove them and try again.");

theForm.newsection.focus();

  	return (false);

  	}

  }

}



//========================================================validate image field

function ValidateIMG(theForm) {



if (theForm.section.value == "") {

  	alert("Please choose an album to add your image to.");

	theForm.section.focus();

	return (false);

  }/* else if (theForm.file.value == "") {

  	alert("Please choose an image to add to your selected album.");

	theForm.file.focus();

	return (false);

  }	else if (theForm.file.value != "") {	

var invalid = "'";

if (theForm.file.value.indexOf(invalid) > -1) {

alert("Sorry, apostrophes are not allowed.");

return (false);

}

}



*/

}

//========================================================validate section selection(for image removal)

function ValidateSEC(theForm){

	if (theForm.delsection.value == "") {

  	alert("Please choose an album to remove your image from.");

	theForm.delsection.focus();

	return (false);

  }

	}

//========================================================validate email form

	function ValidateEMAIL(theForm){



  

  if (theForm.email.value == "") {

    alert("Please enter a valid Email Address");

    theForm.email.focus();

    return (false);

  }

if (theForm.email.value.length > 80) {

    alert("Please enter a valid Email Address");

    theForm.email.focus();

    return (false);

  }

if (theForm.email.value.length < 5) {

    alert("Please enter a valid Email Address");

    theForm.email.focus();

    return (false);

  }

if (theForm.email.value.indexOf ('@', 0) == -1) {

    alert("Please enter a valid Email Address");

    theForm.email.focus();

    return (false);

    }

var dot=".";

if (theForm.email.value.indexOf(dot)==-1 || theForm.email.value.indexOf(dot)==0 || theForm.email.value.indexOf(dot)==theForm.email.value.length){

	      alert("Please enter a valid Email Address");

	      theForm.email.focus();

	      return false

  }

  
  if (theForm.name.value == "") {

     alert("Please enter a name.");

     theForm.name.focus();

     return (false);

    } 
  

  if (theForm.comment.value == "") {

     alert("Please enter a message.");

     theForm.comment.focus();

     return (false);

    } 
/*
		else

	if (theForm.message.value.length > 200) {

     alert('Message limited to 200 characters. Please remove '+(theForm.message.value.length - 200)+ ' characters');

     theForm.message.focus();

     return (false);

	 }



*/
	}
/*
//==============================================================character count on email

function textCounter(field,cntfield,maxlimit) {

if (field.value.length > maxlimit) // if too long...trim it!

field.value = field.value.substring(0, maxlimit);

// otherwise, update 'characters left' counter

else

cntfield.value = maxlimit - field.value.length;

}*/