<?php if ( ! is_user_logged_in() ) { global $gp; ?>

	<div id="login">

		<div id="login-box">		
		
			<a href="#" id="login-close" class="button"></a>
	
			<?php if ( $gp['login_link'] == 'enabled' && $gp['login_popup_box'] == 'enabled' ) { ?>
						
				<div id="login-form-wrapper">

					<h3><?php _e('Sign In' ,'gp_lang'); ?></h3>		

					<form name="loginform" id="loginform" action="<?php echo site_url( 'wp-login.php', 'login_post' ); ?>" method="post">
			
						<div class="login-form">
		
							<div<?php if ( has_action ( 'oa_social_login' ) ) { ?> class="standard-login"<?php } ?>>
						
								<?php if ( has_action ( 'oa_social_login' ) ) { ?><div class="standard-login-header"><?php _e( 'Login via your site account', 'gp_lang' ); ?></div><?php } ?>
						
								<p class="username"><input type="text" name="log" id="user_login" value="<?php if ( ! empty( $user_login ) ) { echo esc_html( stripslashes( $user_login ), 1 ); } ?>" size="20" placeholder="<?php _e( 'Username', 'gp_lang' ); ?>" /></p>
				
								<p class="password"><input type="password" name="pwd" id="user_pass" size="20" placeholder="<?php _e( 'Password', 'gp_lang' ); ?>" /></p>
			
								<p class="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> <?php _e( 'Remember Me', 'gp_lang' ); ?></p>
						
								<?php if ( function_exists( 'cptch_display_captcha_custom' ) ) { ?>
									<input type='hidden' name='cntctfrm_contact_action' value='true' />
									<p>
										<?php echo cptch_display_captcha_custom(); ?>
									</p>
								<?php } ?>	
								<?php if ( function_exists( 'cptchpr_display_captcha_custom' ) ) { ?>
									<input type='hidden' name='cntctfrm_contact_action' value='true' />
									<p>
										<?php echo cptchpr_display_captcha_custom(); ?>
									</p>	
								<?php } ?>
											
								<?php if ( has_action ( 'oa_social_login' ) ) { ?><p><a href="#" class="social-login-link"><?php _e( 'Or login via a social network account', 'gp_lang' ); ?></a></p><?php } ?>
														
							</div>						
						
							<?php if ( has_action ( 'oa_social_login' ) ) { ?>
								<div class="or-divider"><span><?php _e( 'OR', 'gp_lang' ); ?></span></div>
								<div class="social-login">
									<?php do_action( 'oa_social_login' ); ?>
								</div>
							<?php } ?>	
						
							<span id="login-result" class="login-result"></span>
				
						</div>
				
						<input type="submit" name="wp-submit" id="wp-submit" value="<?php _e( 'Sign In', 'gp_lang' ); ?>" />

						<span class="login-links">
							<?php if ( $gp['register_link'] == 'enabled' && get_option( 'users_can_register' ) ) { ?><a href="<?php if ( function_exists( 'bp_is_active' ) ) { echo esc_url( bp_get_signup_page( false ) ); } elseif ( $gp['register_popup_box'] == 'enabled' ) { echo '#'; } elseif ( $gp['custom_register_link'] ) { echo esc_url( $gp['custom_register_link'] ); } ?>" class="register-link"><?php _e( 'Register', 'gp_lang' ); ?></a><?php } ?>
							<a href="#" class="lost-password-link"><?php _e( 'Lost Password', 'gp_lang' ); ?></a>
						</span>
			
						<input type="hidden" name="action" value="gp_login" />
				
					</form>
				
				</div><!-- END LOGIN FORM WRAPPER -->
						
				<div id="lost-password-form-wrapper">
	
					<h3><?php _e('Lost Password', 'gp_lang'); ?></h3>

					<form name="lostpasswordform" id="lostpasswordform" action="#" method="post">
				
						<div class="login-form">
				
							<p><?php _e('Please enter your username or email address. You will receive a link to create a new password via email.', 'gp_lang'); ?></p>	
						
							<p><input type="text" name="user_login" id="user_login" value="" size="20" placeholder="<?php _e('Username or Email', 'gp_lang'); ?>" /></p>
					
							<span id="lost-password-result" class="login-result"></span>
					
						</div>
			
						<input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Reset Password', 'gp_lang'); ?>" />
				
						<span class="login-links">
							<?php if ( $gp['register_link'] == 'enabled' && get_option( 'users_can_register' ) ) { ?><a href="<?php if ( function_exists( 'bp_is_active' ) ) { echo bp_get_signup_page( false ); } elseif ( $gp['register_popup_box'] == 'enabled' ) { echo '#'; } elseif ( $gp['custom_register_link'] ) { echo esc_url( $gp['custom_register_link' ] ); } ?>" class="register-link"><?php _e( 'Register', 'gp_lang' ); ?></a><?php } ?>
							<?php if ( $gp['login_link'] == 'enabled' ) { ?><a href="<?php if ( $gp['login_popup_box'] == 'enable' ) { echo '#'; } elseif ( $gp['custom_login_link'] ) { echo esc_url( $gp['custom_login_link'] ); } ?>" class="login-link"><?php _e( 'Sign In', 'gp_lang' ); ?></a><?php } ?>
						</span>
			
						<input type="hidden" name="action" value="gp_lost_password" />
						<input type="hidden" name="gp_pwd_nonce" value="<?php echo wp_create_nonce("gp_pwd_nonce"); ?>" />
								
					</form>

				</div><!-- END LOST PASSWORD FORM -->

				<?php if ( has_action ( 'oa_social_login' ) ) { ?>
			
					<div id="social-login-form-wrapper">
	
						<h3><?php _e('Sign In', 'gp_lang'); ?></h3>

						<form id="social-login-form" action="#" method="post">	
				
							<div class="login-form">
								<?php do_action( 'oa_social_login' ); ?>
							</div>
								
							<span class="login-links">
								<?php if ( $gp['register_link'] == 'enabled' && get_option( 'users_can_register' ) ) { ?><a href="<?php if ( function_exists( 'bp_is_active' ) ) { echo bp_get_signup_page( false ); } elseif ( $gp['register_popup_box'] == 'enabled' ) { echo '#'; } elseif ( $gp['custom_register_link'] ) { echo esc_url( $gp['custom_register_link'] ); } ?>" class="register-link"><?php _e( 'Register', 'gp_lang' ); ?></a><?php } ?>
								<a href="#" class="lost-password-link"><?php _e( 'Lost Password', 'gp_lang' ); ?></a>
							</span>
							
						</form>

					</div><!-- END SOCIAL LOGIN FORM -->
				
				<?php } ?>
			
			<?php } ?>
						
			<?php if ( ( $gp['register_link'] == 'enabled' && get_option( 'users_can_register' ) ) && ( $gp['register_popup_box'] == 'enabled' && ! function_exists( 'bp_is_active' ) ) ) { ?>
			
				<div id="register-form-wrapper">

					<h3><?php _e( 'Sign Up' ,'gp_lang' ); ?></h3>		

					<form name="registerform" id="registerform" action="<?php echo site_url( 'wp-login.php?action=register', 'login_post' ); ?>" method="post">
			
						<div class="login-form">
  
							<p class="user_login"><input type="text" name="user_login" id="user_login" value="<?php if ( ! empty( $user_login ) ) { echo esc_html( stripslashes( $user_login ), 1 ); } ?>" size="20" placeholder="<?php _e( 'Username', 'gp_lang' ); ?>" /></p>
			
							<p class="user_email"><input type="email" name="user_email" id="user_email" size="25" placeholder="<?php _e( 'Email', 'gp_lang' ); ?>" /></p>

							<p class="user_pass"><input type="password" name="user_pass" id="user_pass" size="20" placeholder="<?php _e( 'Password', 'gp_lang' ); ?>" /></p>
			

						
								<?php if ( function_exists( 'cptch_display_captcha_custom' ) ) { ?>
									<input type='hidden' name='cntctfrm_contact_action' value='true' />
									<p>
										<?php echo cptch_display_captcha_custom(); ?>
									</p>
								<?php } ?>	
								<?php if ( function_exists( 'cptchpr_display_captcha_custom' ) ) { ?>
									<input type='hidden' name='cntctfrm_contact_action' value='true' />
									<p>
										<?php echo cptchpr_display_captcha_custom(); ?>
									</p>	
								<?php } ?>					
							<span id="register-result" class="login-result"></span>
				
						</div>
									
						<input type="submit" name="wp-submit" id="wp-submit" value="<?php _e( 'Sign Up', 'gp_lang' ); ?>" />

						<span class="login-links">
							<?php if ( $gp['login_link'] == 'enabled' ) { ?><a href="<?php if ( $gp['login_popup_box'] == 'enable' ) { echo '#'; } elseif ( $gp['custom_login_link'] ) { echo esc_url( $gp['custom_login_link'] ); } ?>" class="login-link"><?php _e( 'Sign In', 'gp_lang' ); ?></a><?php } ?>
						</span>
					
						<input type="hidden" name="action" value="gp_register" />
				
					</form>
				
				</div><!-- END REGISTER FORM WRAPPER -->
			
			<?php } ?>
								
		</div>
	
		<script>  	

		jQuery( document ).ready(function( $ ) {							

			'use strict';

			<?php if ( $gp['login_link'] == 'enabled' && $gp['login_popup_box'] == 'enabled' ) { ?>
				$("#loginform").submit(function() {
					$('#login-result').html('<span class="verify-form"><?php _e("Verifying...", "gp_lang"); ?></span>').fadeIn();
					var input_data = $('#loginform').serialize();
					$.ajax({
						type: "POST",
						<?php if ( is_ssl() ) { ?>
							url:  "<?php echo 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
						<?php } else { ?>
							url:  "<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
						<?php } ?>	
						data: input_data,
						success: function(msg) {
							$('.verify-form').remove();
							$('<span>').html(msg).appendTo('#login-result').hide().fadeIn('slow');
						}
					});
					return false;
				});
			
				$("#lostpasswordform").submit(function() {
					$('#lost-password-result').html('<span class="verify-form"><?php _e("Verifying...", "gp_lang"); ?></span>').fadeIn();
					var input_data = $('#lostpasswordform').serialize();
					$.ajax({
						type: "POST",
						<?php if ( is_ssl() ) { ?>
							url:  "<?php echo 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
						<?php } else { ?>
							url:  "<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
						<?php } ?>
						data: input_data,
						success: function(msg) {
							$('.verify-form').remove();
							$('<span>').html(msg).appendTo('#lost-password-result').hide().fadeIn('slow');
						}
					});
					return false;
				});
							
			<?php } ?>
			
			<?php if ( $gp['register_link'] == 'enabled' && get_option( 'users_can_register' ) && $gp['register_popup_box'] == 'enabled' && ! function_exists( 'bp_is_active' ) ) { ?>
				$("#registerform").submit(function() {
					$('#register-result').html('<span class="verify-form"><?php _e("Verifying...", "gp_lang"); ?></span>').fadeIn();
					var input_data = $('#registerform').serialize();
					$.ajax({
						type: "POST",
						<?php if ( is_ssl() ) { ?>
							url:  "<?php echo 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
						<?php } else { ?>
							url:  "<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
						<?php } ?>	
						data: input_data,
						success: function(msg) {
							$('.verify-form').remove();
							$('<span>').html(msg).appendTo('#register-result').hide().fadeIn('slow');
							if ( ! $( '#register-result > span > span' ).hasClass( 'error' ) ) {						
								$( '#registerform .login-form > input[type="text"]' ).val( '' );
								$( '#registerform .login-form > p, #registerform #wp-submit' ).hide();
							} 
						}
					});
					return false;
				});
			<?php } ?>

			<?php if ( $gp['login_link'] == 'enabled' && $gp['login_popup_box'] == 'enabled' ) { ?>
				$( '.login-link' ).click(function() {
					$( '#login-form-wrapper' ).show();
					$( '#register-form-wrapper, #lost-password-form-wrapper, #social-login-form-wrapper' ).hide();
					$( '.login-result > span' ).remove();
					return false;
				});		
								
				$( '.lost-password-link' ).click(function() {
					$( '#lost-password-form-wrapper' ).show();
					$( '#register-form-wrapper, #login-form-wrapper, #social-login-form-wrapper' ).hide();
					$( '.login-result > span' ).remove();
					return false;
				});		

				<?php if ( has_action ( 'oa_social_login' ) ) { ?>
					$( '.social-login-link' ).click(function() {
						$( '#social-login-form-wrapper' ).show();
						$( '#login-form-wrapper, #register-form-wrapper, #lost-password-form-wrapper' ).hide();
						$( '.login-result > span' ).remove();
						return false;
					});		
				<?php } ?>
			<?php } ?>
						
			<?php if ( $gp['register_link'] == 'enabled' && get_option( 'users_can_register' ) && $gp['register_popup_box'] == 'enabled' && ! function_exists( 'bp_is_active' ) ) { ?>
				$( '.register-link' ).click(function() {
					$( '#register-form-wrapper, #registerform .login-form > p, #registerform #wp-submit' ).show();
					$( '#registerform .login-form p > input[type="text"]' ).val( '' );
					$( '#login-form-wrapper, #lost-password-form-wrapper, #social-login-form-wrapper' ).hide();
					$( '.login-result > span' ).remove();
					return false;
				});	
			
				$( '#register-link' ).click(function() {
					$( '#register-form-wrapper, #registerform .login-form > p, #registerform #wp-submit' ).show();
					$( '#registerform .login-form p > input[type="text"]' ).val( '' );
					$( '#login-form-wrapper, #lost-password-form-wrapper, #social-login-form-wrapper' ).hide();
					$( '.login-result > span' ).remove();
							
				});
			<?php } ?>
		
			$( '#login-close' ).click(function() {
				$( '.login-result > span' ).remove();
			});		

		});
		
		</script>
				
	</div>
	
<?php } ?>