var bigstring = " ";

function shake(n) 
{
	if (self.moveBy) 
	{
		for (i = 10; i > 0; i--) 
		{
			for (j = n; j > 0; j--) 
			{
				self.moveBy(0,i);
				self.moveBy(i,0);
				self.moveBy(0,-i);
				self.moveBy(-i,0);
			}
		}
	}
}
function doesexist(inputValue, inputExpected) 
{
  var aCharExists=0
  if (inputValue) 
  {
    for (var i=0; i<inputValue.length; i++) 
    {
      if (inputValue.charAt(i) != " ") 
      {
        aCharExists = 1
      }
    }
  }
  if (!aCharExists) 
  {
    bigstring = bigstring += inputExpected += "\n ";
  }
}
function check_user_create()
{
	doesexist(document.form1.username.value, '- Enter Username')
	doesexist(document.form1.password.value, '- Enter Password')
	doesexist(document.form1.password_confirm.value, '- Confirm Password')
	doesexist(document.form1.first_name.value, '- Enter First Name')
	doesexist(document.form1.last_name.value, '- Enter Last Name')
	doesexist(document.form1.email.value, '- Enter Your Email')
	doesexist(document.form1.dob_Y.value, '- Enter Year of Birth')
	doesexist(document.form1.dob_M.value, '- Enter Month of Birth')
	doesexist(document.form1.dob_D.value, '- Enter Day of Birth')
  	if (bigstring != " ")
	{
		alert("Please fill out the following fields: \n" + bigstring)
		bigstring = " "
		return false
	}
	return true
}
function check_review() 
{
  doesexist(document.form1.restaurant_ID.value, '- Which Restaurant')
  doesexist(document.form1.reviewer_name.value, '- Your Name')
  doesexist(document.form1.reviewer_location.value, '- City, State')
  doesexist(document.form1.stars_service.value, '- Service Stars')
  doesexist(document.form1.stars_food.value, '- Food Stars')
  doesexist(document.form1.stars_atmosphere.value, '- Atmosphere Stars')
  doesexist(document.form1.stars_total.value, '- Total Stars')
  doesexist(document.form1.review_title.value, '- Review Title')
  doesexist(document.form1.review.value, '- Review')
  if (bigstring != " ")
  {
    alert("Please fill out the following fields: \n" + bigstring)
    bigstring = " "
    return false
  }
  return true
}
function check_review_comment(review_ID) 
{
	var theFormName = review_ID.toString()
	var theNewFormName = 'comment_form'+theFormName
	  doesexist(document.forms[theNewFormName].commenter.value, '- Commenter (Your Name)')
	  doesexist(document.forms[theNewFormName].valid_comment_vote.value, '- Review Stars')
	  doesexist(document.forms[theNewFormName].comment.value, '- Review Comment')
	  if (bigstring != " ")
	  {
	    alert("Please fill out the following fields: \n" + bigstring)
	    bigstring = " "
	    return false
	  }
	  return true
}
function newsletter_signup_check()
{
	doesexist(document.newsletter_form.email.value, '- Email Address')
	if (bigstring != " ")
  	{
    	alert("Please fill out the following fields: \n" + bigstring)
    	bigstring = " "
    	return false
  	}
  	return true
}