/*****************************************************************************************************/
/*                                                                                                   */
/*                                     'REGISTER PANEL' CLASS                                        */          
/*                                                                                                   */
/*****************************************************************************************************/

function REGISTER_GINFO(parent){
	var JSObject = this;
	this.type = "Register"; 
	this.arr_inputs = ["_inp_Email","_inp_Password","_inp_RetypePassword","_inp_Firstname","_inp_Lastname","_inp_Gender","_inp_Occupation",
					   "_inp_Address","_inp_City","_inp_State","_inp_Country","_inp_Zip",
					   "_inp_Homephone1","_inp_Homephone2","_inp_Homephone3",
					   "_inp_Workphone1","_inp_Workphone2","_inp_Workphone3",
					   "_inp_Mobilephone1","_inp_Mobilephone2","_inp_Mobilephone3",
					   "_inp_Website","_inp_Timetoreach","_inp_Timelisten","_inp_Favouritemusic",
					   "_inp_Policy"];
	this.form = document.getElementById("register_form");
	this.sendBtn = this.form["sendBtn"];
	this.resetBtn = this.form["resetBtn"];
	this.ajax = false;
	
	/*****************************************************************************************************/
	/*                                                                                                   */
	/*                                  FUNCTION INIT INPUTS REGISTER PANEL                              */          
	/*                                                                                                   */
	/*****************************************************************************************************/
	this.init = function(){
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                          INFORMATION                                              */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		this._inp_Email = new INPUTFIELD(this, document.getElementById('reg_email'));
		this._inp_Password = new INPUTFIELD(this, document.getElementById('reg_password'));
		this._inp_RetypePassword = new INPUTFIELD(this, document.getElementById('reg_retypepassword'));
		this._inp_Firstname = new INPUTFIELD(this, document.getElementById('reg_firstname'));
		this._inp_Lastname = new INPUTFIELD(this, document.getElementById('reg_lastname'));
		this._inp_Gender = new INPUTFIELD(this, document.getElementsByName('reg_gender'));
		this._inp_Occupation = new INPUTFIELD(this, document.getElementById('reg_occupation'));
		this._inp_Address = new INPUTFIELD(this, document.getElementById('reg_address'));
		this._inp_City = new INPUTFIELD(this, document.getElementById('reg_city'));
		this._inp_State = new INPUTFIELD(this, document.getElementById('reg_provincestate'));
		this._inp_Country = new INPUTFIELD(this, document.getElementById('reg_country'));
		this._inp_Zip = new INPUTFIELD(this, document.getElementById('reg_postalzip'));
		this._inp_Homephone1 = new INPUTFIELD(this, document.getElementById('reg_homephone1'));
		this._inp_Homephone2 = new INPUTFIELD(this, document.getElementById('reg_homephone2'));
		this._inp_Homephone3 = new INPUTFIELD(this, document.getElementById('reg_homephone3'));
		this._inp_Workphone1 = new INPUTFIELD(this, document.getElementById('reg_workphone1'));
		this._inp_Workphone2 = new INPUTFIELD(this, document.getElementById('reg_workphone2'));
		this._inp_Workphone3 = new INPUTFIELD(this, document.getElementById('reg_workphone3'));
		this._inp_Mobilephone1 = new INPUTFIELD(this, document.getElementById('reg_mobilephone1'));
		this._inp_Mobilephone2 = new INPUTFIELD(this, document.getElementById('reg_mobilephone2'));
		this._inp_Mobilephone3 = new INPUTFIELD(this, document.getElementById('reg_mobilephone3'));
		this._inp_Website = new INPUTFIELD(this, document.getElementById('reg_website'));
		this._inp_Timetoreach = new INPUTFIELD(this, document.getElementById('reg_timetoreach'));
		this._inp_Timelisten = new INPUTFIELD(this, document.getElementById('reg_timelisten'));
		this._inp_Favouritemusic = new INPUTFIELD(this, document.getElementById('reg_favouritemusic'));
		this._inp_Join = new INPUTFIELD(this, document.getElementById('reg_join'));
		this._inp_Policy = new INPUTFIELD(this, document.getElementById('reg_policy'));
		this._inp_Birthday = new INPUTFIELD(this, document.getElementById('birth_day'));
		

	}
	
	
	/*****************************************************************************************************/
	/*                                                                                                   */
	/*                                  FUNCTION CREATE REGISTER PANEL                                   */          
	/*                                                                                                   */
	/*****************************************************************************************************/
	this.initCreate = function(){
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                      INPUT 'EMAIL' ACTIONS                                        */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Email.input;
		this._inp_Email.setRequired("yes");
		this._inp_Email.setReadySubmit(true);
		this._inp_Email.setValidationType("email");
		this._inp_Email.setValidationNetworkType("server");

		this._inp_Email.setAJAXFunction(function (data){
													//alert(document.getElementById("checkregisteremailpath").value+" "+'email='+data);
													Email.www.post(document.getElementById("checkregisteremailpath").value,
																 'email='+data, 
																  function(response) {
																	  //alert(response)
																	  if (parseInt(response)==1){
																		Email.displayError(Email.errors[2]);
																		Email.setReadySubmit(false);
																		Email.ajaxReturn = false;
																		JSObject.ajax = false;
																	  }
																	  else{
																		Email.hideError();
																		Email.setReadySubmit(true);
																		Email.ajaxReturn = true;
																		Email.return_validateF();
																	  }
																	  Email.www = new WWW(true,'xmlhttp'); 
																	}
																 );
															});
		
		var errors = ["This information is required.",
					  "Only letters, numbers, underscores, dots(.) and one @ are allowed.",
					  "Email already registered!"];
		
		this._inp_Email.addErrors(errors);
		this._inp_Email.setErrorsContainer("reg_email_container");
		var Email = this._inp_Email;
		this._inp_Email.www = new WWW(true,'xmlhttp');
		this._inp_Email.validateF = function(){
			//alert("Email1:" + JSObject.ajax)
			if (this.submit_ready == true){
				this.ajaxF(this.data);
				this.ajaxReturn = false;
			}
			else{
				JSObject.ajax = false;	
			}
		}
		this._inp_Email.return_validateF = function(){
			//alert("Email2:" + JSObject.ajax)
			if (JSObject.ajax == true){
				JSObject.validate();
			}
		}
		this._inp_Email.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                    INPUT 'PASSWORD' ACTIONS                                       */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Password.input;
		this._inp_Password.setRequired("yes");
		this._inp_Password.addData(input.value);
		if (this._inp_Password.data.length > 0){
			this._inp_Password.setReadySubmit(true);
		}
		else{
			this._inp_Password.setReadySubmit(false);
		}
		this._inp_Password.setValidationType("password");
		var errors = ["This information is required.",
			          "Capitalization matters. Use 6 to 32 characters, and don't use your email address."];
		this._inp_Password.addErrors(errors);
		this._inp_Password.setErrorsContainer("reg_password_container");
		this._inp_Password.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                    INPUT 'RETYPEPASSWORD' ACTIONS                                 */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_RetypePassword.input;
		input.value = "";
		this._inp_RetypePassword.setRequired("yes");
		this._inp_RetypePassword.addData(input.value);
		this._inp_RetypePassword.setReadySubmit(false);
		this._inp_RetypePassword.setValidationType("retypepassword");
		var errors = ["This information is required.",
			      	  "Please verify your password again."];
		this._inp_RetypePassword.setErrorsContainer("reg_retypepassword_container");
		this._inp_RetypePassword.addErrors(errors);
		this._inp_RetypePassword.initActions();
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                      INPUT 'FIRSTNAME' ACTIONS                                    */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Firstname.input;
		this._inp_Firstname.setRequired("yes"); 
		this._inp_Firstname.addData(input.value);
		if (this._inp_Firstname.data.length > 0){
			this._inp_Firstname.setReadySubmit(true);
		}
		else{
			this._inp_Firstname.setReadySubmit(false);
		}
		this._inp_Firstname.setValidationType("alpha_extended");
		var extentedChars = [" ",".","-","'"];
		this._inp_Firstname.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only letters, spaces, hyphens, dots(.) and apostrophes are allowed."];
		this._inp_Firstname.addErrors(errors);
		this._inp_Firstname.setErrorsContainer("reg_firstname_container");
		this._inp_Firstname.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                      INPUT 'LASTNAME' ACTIONS                                     */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Lastname.input;
		this._inp_Lastname.setRequired("yes"); 
		this._inp_Lastname.addData(input.value);
		if (this._inp_Lastname.data.length > 0){
			this._inp_Lastname.setReadySubmit(true);
		}
		else{
			this._inp_Lastname.setReadySubmit(false);
		}
		this._inp_Lastname.setValidationType("alpha_extended");
		var extentedChars = [" ",".","-","'"];
		this._inp_Lastname.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only letters, spaces, hyphens, dots(.) and apostrophes are allowed."];
		this._inp_Lastname.addErrors(errors);
		this._inp_Lastname.setErrorsContainer("reg_lastname_container");
		this._inp_Lastname.initActions();
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                      RADIO 'GENDER' ACTIONS                                       */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Gender.input;
		this._inp_Gender.setRequired("yes"); 
		this._inp_Gender.setValidationType("normal");
		var errors = ["Please select your gender.",
			          ""];
		this._inp_Gender.addErrors(errors);
		this._inp_Gender.setErrorsContainer("reg_gender_container");
		this._inp_Gender.initActions();
		this._inp_Gender.input[0].onclick = function(){
			JSObject._inp_Gender.setReadySubmit(true);
			JSObject._inp_Gender.addData(this.value);
			JSObject._inp_Gender.hideError();
		}
		this._inp_Gender.input[1].onclick = function(){
			JSObject._inp_Gender.setReadySubmit(true);	
			JSObject._inp_Gender.addData(this.value);
			JSObject._inp_Gender.hideError();
		}
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                      INPUT 'OCCUPATION' ACTIONS                                   */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Occupation.input;
		this._inp_Occupation.setRequired("yes"); 
		this._inp_Occupation.addData(input.value);
		if (this._inp_Occupation.data.length > 0){
			this._inp_Occupation.setReadySubmit(true);
		}
		else{
			this._inp_Occupation.setReadySubmit(false);
		}
		this._inp_Occupation.setValidationType("alphanumeric_extended");
		var extentedChars = [" ",".","-","'","/","+"];
		this._inp_Occupation.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only letters, numbers, spaces, hyphens, dots(.), slashes(/) and apostrophes(') are allowed."];
		this._inp_Occupation.addErrors(errors);
		this._inp_Occupation.setErrorsContainer("reg_occupation_container");
		this._inp_Occupation.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                      INPUT 'ADDRESS' ACTIONS                                      */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Address.input;
		this._inp_Address.setRequired("yes"); 
		this._inp_Address.addData(input.value);
		if (this._inp_Address.data.length > 0){
			this._inp_Address.setReadySubmit(true);
		}
		else{
			this._inp_Address.setReadySubmit(false);
		}
		this._inp_Address.setValidationType("normal");
		var errors = ["This information is required.",
			          ""];
		this._inp_Address.addErrors(errors);
		this._inp_Address.setErrorsContainer("reg_address_container");
		this._inp_Address.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                        INPUT 'CITY' ACTIONS                                       */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_City.input;
		this._inp_City.setRequired("yes"); 
		this._inp_City.addData(input.value);
		if (this._inp_City.data.length > 0){
			this._inp_City.setReadySubmit(true);
		}
		else{
			this._inp_City.setReadySubmit(false);
		}
		this._inp_City.setValidationType("normal");
		var errors = ["This information is required.",
			          ""];
		this._inp_City.addErrors(errors);
		this._inp_City.setErrorsContainer("reg_city_container");
		this._inp_City.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                        INPUT 'STATE' ACTIONS                                      */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_State.input;
		this._inp_State.setRequired("yes"); 
		this._inp_State.addData(input.value);
		if (this._inp_State.data.length > 0){
			this._inp_State.setReadySubmit(true);
		}
		else{
			this._inp_State.setReadySubmit(false);
		}
		this._inp_State.setValidationType("normal");
		var errors = ["This information is required.",
			          ""];
		this._inp_State.addErrors(errors);
		this._inp_State.setErrorsContainer("reg_provincestate_container");
		this._inp_State.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                       INPUT 'COUNTRY' ACTIONS                                     */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Country.input;
		this._inp_Country.setRequired("yes"); 
		this._inp_Country.addData(input.value);
		if (this._inp_Country.data.length > 0){
			this._inp_Country.setReadySubmit(true);
		}
		else{
			this._inp_Country.setReadySubmit(false);
		}
		this._inp_Country.setValidationType("normal");
		var errors = ["This information is required.",
			          ""];
		this._inp_Country.addErrors(errors);
		this._inp_Country.setErrorsContainer("reg_country_container");
		this._inp_Country.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                       INPUT 'POSTAL ZIP' ACTIONS                                  */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Zip.input;
		this._inp_Zip.setRequired("yes"); 
		this._inp_Zip.addData(input.value);
		if (this._inp_Zip.data.length > 0){
			this._inp_Zip.setReadySubmit(true);
		}
		else{
			this._inp_Zip.setReadySubmit(false);
		}
		this._inp_Zip.setValidationType("normal");
		var errors = ["This information is required.",
			          ""];
		this._inp_Zip.addErrors(errors);
		this._inp_Zip.setErrorsContainer("reg_postalzip_container");
		this._inp_Zip.initActions();
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                       INPUT 'HOMEPHONE' ACTIONS                                   */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Homephone1.input;
		this._inp_Homephone1.setRequired("yes"); 
		this._inp_Homephone1.addData(input.value);
		if (this._inp_Homephone1.data.length > 0){
			this._inp_Homephone1.setReadySubmit(true);
		}
		else{
			this._inp_Homephone1.setReadySubmit(false);
		}
		this._inp_Homephone1.setValidationType("numeric_extended");
		var extentedChars = ["+","-",".","/"];
		this._inp_Homephone1.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers, pluses, slashes, hyphens and dots(.) are allowed."];
		this._inp_Homephone1.addErrors(errors);
		this._inp_Homephone1.setErrorsContainer("reg_homephone_container");
		this._inp_Homephone1.initActions();
		
		/*******************************************************************************************************/
		var input = this._inp_Homephone2.input;
		this._inp_Homephone2.setRequired("yes"); 
		this._inp_Homephone2.addData(input.value);
		if (this._inp_Homephone2.data.length > 0){
			this._inp_Homephone2.setReadySubmit(true);
		}
		else{
			this._inp_Homephone2.setReadySubmit(false);
		}
		this._inp_Homephone2.setValidationType("numeric_extended");
		var extentedChars = ["."];
		this._inp_Homephone2.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers are allowed."];
		this._inp_Homephone2.addErrors(errors);
		this._inp_Homephone2.setErrorsContainer("reg_homephone_container");
		this._inp_Homephone2.initActions();
		
		/*******************************************************************************************************/
		var input = this._inp_Homephone3.input;
		this._inp_Homephone3.setRequired("yes"); 
		this._inp_Homephone3.addData(input.value);
		if (this._inp_Homephone3.data.length > 0){
			this._inp_Homephone3.setReadySubmit(true);
		}
		else{
			this._inp_Homephone3.setReadySubmit(false);
		}
		this._inp_Homephone3.setValidationType("numeric_extended");
		var extentedChars = ["."];
		this._inp_Homephone3.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers are allowed."];
		this._inp_Homephone3.addErrors(errors);
		this._inp_Homephone3.setErrorsContainer("reg_homephone_container");
		this._inp_Homephone3.initActions();
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                       INPUT 'WORKPHONE' ACTIONS                                   */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Workphone1.input;
		this._inp_Workphone1.setRequired("yes"); 
		this._inp_Workphone1.addData(input.value);
		if (this._inp_Workphone1.data.length > 0){
			this._inp_Workphone1.setReadySubmit(true);
		}
		else{
			this._inp_Workphone1.setReadySubmit(false);
		}
		this._inp_Workphone1.setValidationType("numeric_extended");
		var extentedChars = ["+","-",".","/"];
		this._inp_Workphone1.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers, pluses, slashes, hyphens and dots(.) are allowed."];
		this._inp_Workphone1.addErrors(errors);
		this._inp_Workphone1.setErrorsContainer("reg_workphone_container");
		this._inp_Workphone1.initActions();
		
		/*******************************************************************************************************/
		var input = this._inp_Workphone2.input;
		this._inp_Workphone2.setRequired("yes"); 
		this._inp_Workphone2.addData(input.value);
		if (this._inp_Workphone2.data.length > 0){
			this._inp_Workphone2.setReadySubmit(true);
		}
		else{
			this._inp_Workphone2.setReadySubmit(false);
		}
		this._inp_Workphone2.setValidationType("numeric_extended");
		var extentedChars = ["."];
		this._inp_Workphone2.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers are allowed."];
		this._inp_Workphone2.addErrors(errors);
		this._inp_Workphone2.setErrorsContainer("reg_workphone_container");
		this._inp_Workphone2.initActions();
		
		/*******************************************************************************************************/
		var input = this._inp_Workphone3.input;
		this._inp_Workphone3.setRequired("yes"); 
		this._inp_Workphone3.addData(input.value);
		if (this._inp_Workphone3.data.length > 0){
			this._inp_Workphone3.setReadySubmit(true);
		}
		else{
			this._inp_Workphone3.setReadySubmit(false);
		}
		this._inp_Workphone3.setValidationType("numeric_extended");
		var extentedChars = ["."];
		this._inp_Workphone3.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers are allowed."];
		this._inp_Workphone3.addErrors(errors);
		this._inp_Workphone3.setErrorsContainer("reg_workphone_container");
		this._inp_Workphone3.initActions();
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                     INPUT 'MOBILEPHONE' ACTIONS                                   */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Mobilephone1.input;
		this._inp_Mobilephone1.setRequired("yes"); 
		this._inp_Mobilephone1.addData(input.value);
		if (this._inp_Mobilephone1.data.length > 0){
			this._inp_Mobilephone1.setReadySubmit(true);
		}
		else{
			this._inp_Mobilephone1.setReadySubmit(false);
		}
		this._inp_Mobilephone1.setValidationType("numeric_extended");
		var extentedChars = ["+","-",".","/"];
		this._inp_Mobilephone1.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers, pluses, slashes, hyphens and dots(.) are allowed."];
		this._inp_Mobilephone1.addErrors(errors);
		this._inp_Mobilephone1.setErrorsContainer("reg_mobilephone_container");
		this._inp_Mobilephone1.initActions();
		
		/*******************************************************************************************************/
		var input = this._inp_Mobilephone2.input;
		this._inp_Mobilephone2.setRequired("yes"); 
		this._inp_Mobilephone2.addData(input.value);
		if (this._inp_Mobilephone2.data.length > 0){
			this._inp_Mobilephone2.setReadySubmit(true);
		}
		else{
			this._inp_Mobilephone2.setReadySubmit(false);
		}
		this._inp_Mobilephone2.setValidationType("numeric_extended");
		var extentedChars = ["."];
		this._inp_Mobilephone2.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers are allowed."];
		this._inp_Mobilephone2.addErrors(errors);
		this._inp_Mobilephone2.setErrorsContainer("reg_mobilephone_container");
		this._inp_Mobilephone2.initActions();
		
		/*******************************************************************************************************/
		var input = this._inp_Mobilephone3.input;
		this._inp_Mobilephone3.setRequired("yes"); 
		this._inp_Mobilephone3.addData(input.value);
		if (this._inp_Mobilephone3.data.length > 0){
			this._inp_Mobilephone3.setReadySubmit(true);
		}
		else{
			this._inp_Mobilephone3.setReadySubmit(false);
		}
		this._inp_Mobilephone3.setValidationType("numeric_extended");
		var extentedChars = ["."];
		this._inp_Mobilephone3.addExtendedChars(extentedChars);
		var errors = ["This information is required.",
			          "Only numbers are allowed."];
		this._inp_Mobilephone3.addErrors(errors);
		this._inp_Mobilephone3.setErrorsContainer("reg_mobilephone_container");
		this._inp_Mobilephone3.initActions();
		
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                          INPUT 'WEBSITE' ACTIONS                                  */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Website.input;
		this._inp_Website.setRequired("no"); 
		this._inp_Website.addData(input.value);
		this._inp_Website.setReadySubmit(true);
		this._inp_Website.setValidationType("normal");
		var errors = ["",
			          ""];
		this._inp_Website.addErrors(errors);
		this._inp_Website.setErrorsContainer("reg_website_container");
		this._inp_Website.initActions();
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                   INPUT 'TIME TO REACH' ACTIONS                                   */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Timetoreach.input;
		this._inp_Timetoreach.setRequired("yes"); 
		this._inp_Timetoreach.addData(input.value);
		if (this._inp_Timetoreach.data.length > 0){
			this._inp_Timetoreach.setReadySubmit(true);
		}
		else{
			this._inp_Timetoreach.setReadySubmit(false);
		}
		this._inp_Timetoreach.setValidationType("normal");
		var errors = ["This information is required.",
			          ""];
		this._inp_Timetoreach.addErrors(errors);
		this._inp_Timetoreach.setErrorsContainer("reg_timetoreach_container");
		this._inp_Timetoreach.initActions();
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                    INPUT 'TIME LISTEN' ACTIONS                                    */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Timelisten.input;
		this._inp_Timelisten.setRequired("yes"); 
		this._inp_Timelisten.addData(input.value);
		if (this._inp_Timelisten.data.length > 0){
			this._inp_Timelisten.setReadySubmit(true);
		}
		else{
			this._inp_Timelisten.setReadySubmit(false);
		}
		this._inp_Timelisten.setValidationType("normal");
		var errors = ["This information is required.",
			          ""];
		this._inp_Timelisten.addErrors(errors);
		this._inp_Timelisten.setErrorsContainer("reg_timelisten_container");
		this._inp_Timelisten.initActions();
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                 INPUT 'FAVOURITE MUSIC' ACTIONS                                   */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Favouritemusic.input;
		this._inp_Favouritemusic.setRequired("yes"); 
		this._inp_Favouritemusic.addData(input.value);
		if (this._inp_Favouritemusic.data.length > 0){
			this._inp_Favouritemusic.setReadySubmit(true);
		}
		else{
			this._inp_Favouritemusic.setReadySubmit(false);
		}
		this._inp_Favouritemusic.setValidationType("normal");
		var errors = ["This information is required.",
			          ""];
		this._inp_Favouritemusic.addErrors(errors);
		this._inp_Favouritemusic.setErrorsContainer("reg_favouritemusic_container");
		this._inp_Favouritemusic.initActions();
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                   CHECKBOX 'JOIN' ACTIONS                                         */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		
		this._inp_Join.input.onclick = function(){
			
			if (this.checked == true){
				JSObject.sendBtn.disabled = false;	
			}
			else{
				JSObject.sendBtn.disabled = true;		
			}
			
		}
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                 CHECKBOX 'PRIVACY POLICY' ACTIONS                                 */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		var input = this._inp_Policy.input;
		this._inp_Policy.setRequired("yes"); 
		this._inp_Policy.setReadySubmit(false);
		var errors = ["This information is required.",
			          ""];
		this._inp_Policy.addErrors(errors);
		this._inp_Policy.setErrorsContainer("reg_policy_container");
		this._inp_Policy.initActions();
		this._inp_Policy.input.onclick = function(){
			if (this.checked == true){
				JSObject._inp_Policy.setReadySubmit(true);
				//JSObject._inp_Gender.addData(this.value);
				JSObject._inp_Policy.hideError();
			}
			else{
				JSObject._inp_Policy.setReadySubmit(false);
				JSObject._inp_Policy.displayError(JSObject._inp_Policy.errors[0]);
			}
		}
		
		
		
		/*****************************************************************************************************/
		/*                                                                                                   */
		/*                                     SELECTS 'BIRTHDAY' ACTIONS                                    */          
		/*                                                                                                   */
		/*****************************************************************************************************/
		this._inp_Birthday.setRequired("no"); 
		this._inp_Birthday.setReadySubmit(false);
		var errors = ["This information is required. Please choose your birthday.",
			          ""];
		this._inp_Birthday.addErrors(errors);
		this._inp_Birthday.setErrorsContainer("reg_birthday_container");
		this._inp_Birthday.initActions();
		
	}
	
	
	/*****************************************************************************************************/
	/*                                                                                                   */
	/*                               FUNCTION SERVER VALIDATE(AJAX - Email)                              */          
	/*                                                                                                   */
	/*****************************************************************************************************/
	this.initServerValidate = function(){
		this.ajax = true;
		this._inp_Email.validateF();
	}
	
	
	/*****************************************************************************************************/
	/*                                                                                                   */
	/*                                 FUNCTION VALIDATE INFORMATION                                     */          
	/*                                                                                                   */
	/*****************************************************************************************************/
	this.validate = function(){

		this.ajax = false;
		
		var countErrors = 0;
		

		// aflam cate erori sunt in formular
		for (var i=0; i<this.arr_inputs.length; i++){
			var obj = this[this.arr_inputs[i]];
			if (obj.submit_ready == false && obj.data.length == 0 && obj.required=="yes"){
				obj.displayError(obj.errors[0]);
				obj.setReadySubmit(false);
				countErrors++;
			}
			else if (obj.submit_ready == true && obj.data.length == 0 && obj.required=="yes"){
				obj.displayError(obj.errors[0]);
				obj.setReadySubmit(false);
				countErrors++;
			}
			else if (obj.submit_ready == false){ 
				countErrors++;
			}
		}
		
		
		//birthday validation
		var birthday = this.form["birth_month"].value + "/"+this.form["birth_day"].value + "/"+this.form["birth_year"].value;
		var isDate = birthday.isDate(birthday.split("/")[0], birthday.split("/")[1], birthday.split("/")[2]);
		if (isDate == false){
			countErrors++;
			this._inp_Birthday.displayError(this._inp_Birthday.errors[0]);
			this._inp_Birthday.setReadySubmit(false);
		}
		else{
			this._inp_Birthday.hideError();
			this._inp_Birthday.setReadySubmit(true);	
		}
		
		
		//submit form
		if (countErrors==0){ 
			this.form.submit();
		}
		else return false;
		
	}
	
	
	
	/*****************************************************************************************************/
	/*                                                                                                   */
	/*                                   FUNCTION RESET INFORMATION                                      */          
	/*                                                                                                   */
	/*****************************************************************************************************/
	this.resetForm = function(){
		this.ajax = false;
		for (var i=0; i<this.arr_inputs.length; i++){
			var obj = this[this.arr_inputs[i]];
			obj.resetData();
		}
	}
	
}