function checkBlanks(fieldValue1,fieldValue2){
if (fieldValue1=='' || fieldValue2==''){
    alert("All fields must be populated.");
  return false;
}
}

function checkBook(fieldValue1,fieldValue2){
if (fieldValue1=='' || fieldValue2==''){
    alert("Title and Author fields must be populated.");
  return false;
}
if (fieldValue2.indexOf(" ") <0 || fieldValue2.indexOf(" ",fieldValue2.indexOf(" ")+1)>0){
  alert("Author must be in the format John Smith.");
  return false;
}
}

function checkID(fieldValue1){
if (fieldValue1==''){
    alert("ID must be populated.");
  return false;
}
}

function checkRating(idValue,ratingValue,commentValue){
if (idValue=='' || ratingValue=='0' || commentValue==''){
    alert("All fields must be populated.");
  return false;
}
if (commentValue.length>250){
    alert("Description muct be less than 250 characters.");
  return false;
}
}

function checkPwd(user,email,pwd1,pwd2){
if (user=='' || email=='' || pwd1 =='' || pwd2 ==''){
  alert('Please enter values in all 4 fields.');
  return false;
}

if (pwd1.length < 4 || user.length < 4){
  alert('Your password and username must be at least 4 characters long.');
  return false;
}

if (pwd1.indexOf(" ") > -1){
  alert("Sorry, spaces are not allowed.");
  return false;
}

if (pwd1==user){
  alert("Username and password cannot be the same!");
  return false;
}

if (email.indexOf("@")<0 || email.indexOf(".")<0){
  alert("Invalid email.");
  return false;
}

if(pwd1!=pwd2){
  alert("Passwords do not match.");
  return false;
}
}

function bookDetailWindow() 
{ 
var windowName='bookDetail.php?id=1';
window.open(windowName,'BookDetail','width=500,height=500,resizable=yes'); 
}
