function isValidID(id) {
   if (id.value.blank()) {
      alert("Please enter the ID.");
	    id.focus();
	    return false;
   }

   if (id.value.length < 4) {
      alert("ID length is 4~12 chars.");
	    id.focus();
	    return false;
   }

   return true;
}

function isValidPWD(pwd, msg) {
   if (!msg) {
      msg = "";
   }

   if (pwd.value.blank()) {
      alert("Please enter the " + msg + "Password.");
	    pwd.focus();
	    return false;
   }

   if (pwd.value.length < 4) {
      alert("Password length is 4~12 chars.");
	    pwd.focus();
	    return false;
   }

   return true;
}

function isValidPWDConfirm(pwd, pwdConfirm) {  
   if (pwdConfirm.value == "") {
      alert("Confirm the Password.");
      pwdConfirm.focus();
      return false;
   }

   if (pwd.value != pwdConfirm.value) {
      alert("The Password is incorrect.");
      pwdConfirm.focus();
      return false;
   }

   return true;
}

function isValidName(name) {
   if (name.value.blank()) {
      alert("Please enter the Name.");
	    name.focus();
	    return false;
   }

   var regExp = /^[\u0000-\u007F]+$/;

   if (!regExp.test(name.value)) {
      alert("Enter the name in Roman Alphabet.");         
      name.focus();
      return false;
   }

   if (name.value.strip().length < 2){
      alert("Name length is 2~50 chars.");
      name.focus();
      return false;
   }

   return true;
}

function isValidCounCode(code) {
   if (code.value.blank()) {
      alert("Select the Country/Region.");
	    code.focus();
	    return false;
   }

   return true;
}

function isValidZipcode(zipcode) {
   var regExp = /^[\u0000-\u007F]+$/;

   if (!regExp.test(zipcode.value)) {
      alert("Enter the zipcode in Roman Alphabet.");         
      zipcode.focus();
      return false;
   }

   return true;
}

function isValidAddress(address) {
   if (address.value.blank()) {
      alert("Please enter the Address.");
      address.focus();
      return false;
   }

   var regExp = /^[\u0000-\u007F]+$/;

   if (!regExp.test(address.value)) {
      alert("Enter the address in Roman Alphabet.");         
      address.focus();
      return false;
   }

   return true;
}

function isValidPhone(phone) {
   if (phone.value.blank()) {
      alert("Please enter the Telephone");
      phone.focus();
      return false;
   }

   var regExp = /^[\u0000-\u007F]+$/;

   if (!regExp.test(phone.value)) {
      alert("Enter the telephone in Roman Alphabet.");         
      phone.focus();
      return false;
   }

   return true;
}

function isValidChurch(church) {
   if (church.value.blank()) {
      alert("Please enter the Church.");
      church.focus();
      return false;
   }

   var regExp = /^[\u0000-\u007F]+$/;

   if (!regExp.test(church.value)) {
      alert("Enter the church in Roman Alphabet.");         
      church.focus();
      return false;
   }

   return true;
}

function isValidEmail(email) {
   if (email.value.blank()) {
      alert("Please enter the E-mail.");
      email.focus();
      return false;
   }

   var regExp = /^[_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*@[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)+$/;

   if (!regExp.test(email.value)) {
      alert("The E-mail address is incorrect.");
      email.focus();
      return false;
   }

   return true;
}

function isValidImage(image) {
   if (image.value.blank()) {
      alert("Select the Image.");
      return false;
   }

   return true;
}

function isValidTitle(title) {
   if (title.value.blank()) {
      alert("Please enter the Title.");
	    title.focus();
	    return false;
   }

   return true;
}

function isValidContent(content) {
   if (content) {
      if (content.value.blank()) {
         alert("Please enter the Contents.");
		     content.focus();
		     return false;
	    }
   }
   else {
      var editor = FCKeditorAPI.GetInstance("content");
      var xhtml  = editor.GetXHTML(true);

      if (xhtml.blank()) {
         alert("Please enter the Contents.");
	       editor.Focus();
         return false;		 
      }
   }

   return true;
}

function isValidComment(comment) {
   if (comment.value.blank()) {
      alert("Please add Comments.");
	    comment.focus();
	    return false;
   }

   return true;
}

function isValidReply(reply) {
   if (reply.value.blank()) {
      alert("Please enter the Reply.");
	    reply.focus();
	    return false;
   }

   return true;
}

function isValidPrefix(prefix) {   
   if (prefix.value.blank()) {
      alert("Select the Subject.");
	    prefix.focus();
	    return false;
   }

   return true;
}

function isValidMovie(movie) {   
   if (movie.value.blank()) {
      alert("Please upload the Movie File.");	    
	    return false;
   }

   return true;
}

function isValidGenre(genre) {   
   if (genre.value.blank()) {
      alert("Select the Genre.");
	    genre.focus();
	    return false;
   }

   return true;
}

function isValidFlash(flash) {   
   if (flash.value.blank()) {
      alert("Select the Flash File.");
	    flash.focus();
	    return false;
   }

   return true;
}

function isValidURL(url) {   
   if (url.value.blank()) {
      alert("Please enter the URL.");
	    url.focus();
	    return false;
   }

   return true;
}

function isValidSize(width, height) {
   if (width.value.blank()) {
      alert("Please enter the Width.");
      width.focus();
      return false;
   }

   if (width.value < 200 || width.value > 1900) {
      alert("The width is 200~1900 numbers.");
      width.focus();
      return false;
   }

   if (height.value.blank()) {
      alert("Please enter the Height.");
      height.focus();
      return false;
   }

   if (height.value < 200 || height.value > 1200) {
      alert("The height is 200~1200 numbers.");
      height.focus();
      return false;
   }

   return true;
}

function isValidThumbnail(thumbnail) {   
   if (thumbnail.value.blank()) {
      alert("Select the Thumbnail.");
	    thumbnail.focus();
	    return false;
   }

   return true;
}

function isValidAuthor(author) {   
   if (author.value.blank()) {
      alert("Please enter the Picture/Writing.");
	    author.focus();
	    return false;
   }

   return true;
}

function isValidPublisher(publisher) {   
   if (publisher.value.blank()) {
      alert("Please enter the Source.");
	    publisher.focus();
	    return false;
   }

   return true;
}

function isValidDEXTImage(dextImage) {
   if (!dextImage.Count) {
      alert("Please attach the Image File.");
      return false;
   }

   return true;
}

function isValidCateName(name) {
   if (name.value.blank()) {
      alert("Please enter the Category Name.");
	    name.focus();
	    return false;
   }

   if (name.value.search(/\\|:|\*|\?|\"|<|>|\|/) > -1) {
      alert("Please don’t use special characters like this letters.\n\n             \\  :  *  ?  \"  <  >  |");
	    name.focus();
	    return false;
   }

   return true;
}

function isValidCateNo(no) {
   if (no.value == "-1") {
      alert("Select the Category.");
	    no.focus();
	    return false;
   }

   return true;
}

function isValidKeyword(keyword) {
   if (keyword.value.blank()) {
      alert("Please enter the Keyword.");
      keyword.focus();
      return false;
   }

   return true;
}
