<div class="content registration m-0-b">
	<div class="row section-title p-5-l p-5-r p-5-t p-0-b text-center">
		<div class="col">
			<h1 class="m-0-t font-weight-bold"><?php echo ucwords($this->lang->line('reg')); ?></h1>
			<p class="m-0-b"><?php echo $this->lang->line('promo'); ?></p>
		</div>
	</div>
	
	<div class="row m-3-y">
		<div class="col-md-offset-3 col-md-6">
			<form class="form-horizontal registration-form" method="post" action="<?php echo base_url(); ?>registration/save" id="registration_form">
			
				<div class="box box-flat">
					<div class="box-body">
						<div class="row m-2-b">
							<div class="col message <?php echo $respond['type'] ? strtolower($respond['type']) : NULL; ?> text-center" id="message">
							<?php echo ($respond['message']) ? $respond['message'] : NULL; ?>
							<?php
							if($respond['type'] == 'SUCCESS') {
								?>
									<h3 class="text-green"><?php echo strtoupper($this->lang->line('success')); ?></h3>
									<div class="text-center m-1-y text-black"><?php echo $this->lang->line('sucHelperA'); ?> <a href="<?php echo base_url(); ?>login" class="font-18"><?php echo $this->lang->line('loginNow'); ?></a> <?php echo $this->lang->line('sucHelperB'); ?>.</div>
								<?php
							}
							
							if($respond['type'] == 'FAIL') {
								?>
									<h3 class="text-red"><?php echo strtoupper($this->lang->line('fail')); ?></h3>
									<div class="text-center m-1-y text-black"><?php echo $respond['message']; ?></div>
								<?php
							}
							?>
							</div>
						</div>
					
						<div class="form-group registration-form-group">
							<label class="col-xs-12 required registration-form-label"><?php echo $this->lang->line('pTitle'); ?></label>
							<div class="col-xs-12">
								<input type="text" class="form-control validate[required] registration-form-input" name="projecttitle" id="register_projecttitle" />
								<div class="helper helper-xs"><?php echo $this->lang->line('pTitleHelper'); ?></div>
							</div>
						</div>
					
						<div class="form-group registration-form-group">
							<label class="col-xs-12 required registration-form-label"><?php echo $this->lang->line('fullName'); ?></label>
							<div class="col-xs-12">
								<input type="text" class="form-control validate[required] registration-form-input" name="fullname" id="register_fullname" />
								<div class="helper helper-xs"><?php echo $this->lang->line('fullNameHelper'); ?></div>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-xs-12 required registration-form-label"><?php echo $this->lang->line('phoneNo'); ?></label>
							<div class="col-xs-12">
								<input type="text" class="form-control validate[required] registration-form-input" name="phone" id="register_phone" />
								<div class="helper helper-xs"><?php echo $this->lang->line('phoneNoHelper'); ?></div>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-xs-12 required registration-form-label"><?php echo $this->lang->line('email'); ?></label>
							<div class="col-xs-12">
								<input type="text" class="form-control validate[required, custom[email]] registration-form-input" name="email" id="register_email" />
								<div class="helper helper-xs"><?php echo $this->lang->line('emailHelper'); ?></div>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-xs-12 required registration-form-label"><?php echo $this->lang->line('pwd'); ?></label>
							<div class="col-xs-12">
								<input type="password" class="form-control validate[required] registration-form-input" name="password" id="register_password" />
								<div class="helper helper-xs"><?php echo $this->lang->line('pwdHelper'); ?></div>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-xs-12 required registration-form-label"><?php echo $this->lang->line('confPwd'); ?></label>
							<div class="col-xs-12">
								<input type="password" class="form-control validate[required] registration-form-input" name="confirm" id="register_confirm" />
								<div class="helper helper-xs"><?php echo $this->lang->line('confPwdHelper'); ?></div>
							</div>
						</div>
						
						<div class="form-group">
							<p class="text-center">
								<?php echo $this->lang->line('signupHelper'); ?><br />
								<a href="<?php echo base_url(); ?>disclaimer/termsofservice" target="_blank"><?php echo $this->lang->line('tns'); ?></a> <?php echo $this->lang->line('n'); ?> 
								<a href="<?php echo base_url(); ?>disclaimer/privacypolicy" target="_blank"><?php echo $this->lang->line('policy'); ?></a>
							</p>
						</div>
					</div>
					
					<div class="box-footer p-1-l p-1-r">
						<button type="submit" class="btn btn-block btn-success"><i class="fa fa-check"></i>&nbsp;<?php echo $this->lang->line('save'); ?></button>
						<div class="text-center m-1-t"><?php echo $this->lang->line('accReady'); ?> <a href="<?php echo base_url(); ?>login"><?php echo $this->lang->line('loginNow'); ?></a></div>
					</div>
				</div>
	
			</form>
			
		</div>
	</div>
</div>

<script>
var emailexists = false;
$(function() {
	$('form#registration_form').off('submit').on('submit',function() {
		if ($(this).validationEngine('validate')) {
			var proceed = true;
			
			var fullname = $.trim(	$('#register_fullname').val()	);
			if(fullname == "") { proceed =  false; $('#register_fullname').validationEngine('showPrompt', '<?php echo $this->lang->line('plsName'); ?>', 'load','bottomRight',1); }
			if(!proceed) return false;
			
			var phone = $.trim(	$('#register_phone').val()	);
			if(phone == "") { proceed =  false; $('#register_phone').validationEngine('showPrompt', '<?php echo $this->lang->line('plsPhoneNo'); ?>', 'load','bottomRight',1); }
			if(!proceed) return false;
			
			var email = $.trim(	$('#register_email').val()	);
			if(email == "") { proceed =  false; $('#register_email').validationEngine('showPrompt', '<?php echo $this->lang->line('plsEmail'); ?>', 'load','bottomRight',1); }
			if(!proceed) return false;
			
			if(emailexists) { proceed = false; $('#register_email').validationEngine('showPrompt', '<?php echo $this->lang->line('emailRegd'); ?>', 'load','bottomRight',1); }
			if(!proceed) return false;
			
			var password = $.trim(	$('#register_password').val()	);
			if(password == "") { proceed =  false; $('#register_password').validationEngine('showPrompt', '<?php echo $this->lang->line('plsPwd'); ?>', 'load','bottomRight',1); }
			if(!proceed) return false;
			
			if(password.length < 5) { proceed =  false; $('#register_password').validationEngine('showPrompt', '<?php echo $this->lang->line('plsPwdHelper'); ?>', 'load','bottomRight',1); }
			if(!proceed) return false;
			
			var confirmp = $.trim(	$('#register_confirm').val()	);
			if(confirmp == "") { proceed =  false; $('#register_confirm').validationEngine('showPrompt', '<?php echo $this->lang->line('plsPwdConf'); ?>', 'load','bottomRight',1); }
			if(!proceed) return false;
			
			if(confirmp != password) {
				proceed =  false;
				$('#register_password').validationEngine('showPrompt', '<?php echo $this->lang->line('pwdConfNotMatch'); ?>', 'load','bottomRight',1);
				$('#register_confirm').validationEngine('showPrompt', '<?php echo $this->lang->line('pwdConfNotMatch'); ?>', 'load','bottomRight',1);
			}
			if(!proceed) return false;
			
			return true;
		} else {
			return false;
		}
	});
	
	$('#register_email').off('change').on('change',$.debounce(250,function() {
		var email = $.trim(	$(this).val()	);
		$.post('<?php echo base_url(); ?>registration/checkemailexistsajax', { email : email }, function(r) {
			$('#message').html('').slideUp();
			$('#register_emailemail').parents('.form-group').eq(0).removeClass('has-error');
			
			if(	Number(r) ) {
				emailexists = true;
				$('#message').html('Email already registered.').slideDown();
				$('#register_email').validationEngine('showPrompt', '<?php echo $this->lang->line('emailRegd'); ?>', 'load','bottomRight',1);
				$('#register_emailemail').parents('.form-group').eq(0).addClass('has-error');
			} else {
				emailexists = false;
			}
		});
	}));
});
</script>




























