<?php
add_action('wp_enqueue_scripts', "hook_javascript_2");
function hook_javascript_2() {
	if (page_id() === 222) {
		?>		
			<script>
				// START JAVASCRIPT
				document.addEventListener("DOMContentLoaded", function(event) {
					if ( jQuery('.mepr-signup-form').length ) {
						document.getElementById("user_first_name1").setAttribute('maxLength', '20');
						document.getElementById("user_last_name1").setAttribute('maxLength', '20');
						document.getElementById("mepr_telefon_mobil1").setAttribute('maxLength', '15');
						
						// FIXME: We need to wait for element
						// document.getElementById("user_email1").setAttribute('maxLength', '50');
						
						if( jQuery('#mepr_user_password1').length )
							document.getElementById("mepr_user_password1").setAttribute('maxLength', '50');
						
						if( jQuery('#mepr_user_password_confirm1').length )
							document.getElementById("mepr_user_password_confirm1").setAttribute('maxLength', '50');		
					}				
				});
			// END JAVASCRIPT
			</script>
		<?php
	}
	else if (page_id() === 986) {
		?>		
			<script>
				// START JAVASCRIPT
				document.addEventListener("DOMContentLoaded", function(event) {
					if ( jQuery('.mepr-account-form').length ) {
						document.getElementById("user_first_name").setAttribute('maxLength', '20');
						document.getElementById("user_last_name").setAttribute('maxLength', '20');
						document.getElementById("mepr_telefon_mobil").setAttribute('maxLength', '15');	
					}				
				});
			// END JAVASCRIPT
			</script>				
		<?php
	}
}