/* Form Autofill function */
var active_color = '#2a2727'; // Colour of user provided text
var inactive_color = '#b6b5ac'; // Colour of default text

$(document).ready(function() {
  $("input.default-value").css("color", inactive_color);
  var default_values = new Array();
  $("input.default-value").focus(function() {
    if (!default_values[this.id]) {
      default_values[this.id] = this.value;
    }
    if (this.value == default_values[this.id]) {
      this.value = '';
      this.style.color = active_color;
    }
    $(this).blur(function() {
      if (this.value == '') {
        this.style.color = inactive_color;
        this.value = default_values[this.id];
      }
    });
  });
});

/* Check if email addresses match, if not, pop an error */

function checkEmail() {
	if (document.theForm.email.value != document.theForm.emailverify.value) {
	var emailaddresserror = document.getElementById("emailaddresserror");
		if ( emailaddresserror.className == "hidden") {
			emailaddresserror.className = "shown";
		}
		else {
			emailaddresserror.className = "hidden";
		}
	}

	else {
	 document.theForm.submit();
	}

}

