function CJSTrialSignup(strFrm)
{
	// Class variables
	var m_objForm = eval(strFrm);								///< Contains the reference to the form object
	var m_strForm = strFrm;										///< Contains the form name as a string - used for eval expressions
	// Set up the function calls in the class
	this.checkForm = checkForm;
    this.toggleExistingContact = toggleExistingContact;

    /**
	* toggleExistingContact; 	Toggles the visibility to the existing client field depending
	*                           on whether the user has indicated that they're an existing client
	*
	* @access public
	* @return void
	*/
	function toggleExistingContact(objSelect) {
		// Check the current value
		/*if (objSelect.selectedIndex == 1) {
        	// Existing client, show text field
            document.getElementById('tricom_contact_row').style.display = '';
		} else {
        	// Not an existing client, hide the text field
            document.getElementById('tricom_contact_row').style.display = 'none';
		}*/
	}

	/**
	* checkTextField; Verifies that a text field isn't empty
	*
	* @access public
	* @return bool
	*/
	function checkTextField(objField, strMessage) {
		// Retrieve the string value
		var strValue = objField.value.replace(/ */, "");
		// Check if the field is empty
		if (strValue == "") {
			// Empty field
			objField.value = "";
			// Alert the user
			alert(strMessage);
			// Indicate the bad data
			return false;
		}
		// Otherwise, return true
		return true;
	}

    /**
	* checkPasswordField; Verifies that a password field is valid
	*
	* @access public
	* @return bool
	*/
	function checkPasswordField(objField, strMessage) {
		// Retrieve the string value
		var strValue = objField.value.replace(/ */, "");
		// Check if the field is empty
		if (strValue.length < 6) {
			// Empty field
			objField.value = "";
			// Alert the user
			alert(strMessage);
			// Indicate the bad data
			return false;
		}
		// Otherwise, return true
		return true;
	}

    /**
	* checkDropdownSelected; Check that a value has been selected in the drop down (where a not selected option is defaulted to)
	*
	* @access private
	* @return bool
	*/
	function checkDropdownSelected(objField, strMessage) {
		// Check if the first option is still selected
		if (objField.selectedIndex == 0) {
			// Alert the user
			alert(strMessage);
			// Indicate the bad data
			return false;
		}
		// Otherwise, return true
		return true;
	}

	/**
	* checkEmailAddress;  Performs basic checking of email address. Verifies that the address has
	*											an '@' symbol and has text on either side, including at least one '.' in the domain name.
	*
	* @access public
	* @return bool
	*/
	function checkEmailAddress(objField, strMessage) {
  		// Retrieve the string value
   		var strValue = objField.value.replace(/ */, "");
		// Create the regular expression object
    	var objRegExp = new RegExp('([^@]*)@([^.@]*)\.([^@]*)');
		// Check that the email address matches
		if (!objField.value.match(objRegExp)) {
			// Alert the user
			alert(strMessage);
			// Indicate the bad data
			return false;
	  	}
	  // Otherwise, return true
	  return true;
	}

	/**
	* checkForm; 	This function checks that the calculator settings are valid.
	*
	* @access public
	* @return bool
	*/
	function checkForm() {
		// Check that the first name has been entered
        if (!checkTextField(m_objForm.first_name, "Please enter your first name")) {
        	// Don't submit the form
        	return false;
		}
        // Check that the last name has been entered
        if (!checkTextField(m_objForm.last_name, "Please enter your last name")) {
        	// Don't submit the form
        	return false;
		}
        // Check that the email address has been entered and is valid
        if (!checkEmailAddress(m_objForm.email, "Please enter a valid email address")) {
        	// Don't submit the form
        	return false;
		}
        // Check that the phone number has been entered
        if (!checkTextField(m_objForm.phone, "Please enter your contact phone number")) {
        	// Don't submit the form
        	return false;
		}
        // Check that a valid password has been entered
        if (!checkPasswordField(m_objForm.password, "Please enter a valid password. Your password must be at least 6 characters in length.")) {
        	// Don't submit the form
        	return false;
		}
        // Check that the post code has been entered
        if (!checkTextField(m_objForm.post_code, "Please enter your post code")) {
        	// Don't submit the form
        	return false;
		}
        // Check that the country has been entered
        if (!checkTextField(m_objForm.country, "Please enter your country")) {
        	// Don't submit the form
        	return false;
		}
        // transfer the tabbed options and platform to the main variable name
		return true;
	}
}
