<?php
global $user_login;
global $user_email;

global $current_user;
get_currentuserinfo(); ?>
<div class="pop-up registration-form">
	<div class="inner">
		<div class="exit">x</div>

		<?php if (!$current_user->ID) { ?>
			<ul class="clearfix">
				<li><a href="#regtabs-1"><?php _e('Login', 'aletheme'); ?></a></li>
				<li><a href="#regtabs-2"><?php _e('Register', 'aletheme'); ?></a></li>
			</ul>

			<div id="regtabs-1">
				<form method="post" action="<?php bloginfo('url') ?>/wp-login.php">
					<input type="text" name="log" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login" placeholder="Login">
					<input type="password" name="pwd" value="" size="20" id="user_pass"  placeholder="Password">

					<?php do_action('login_form'); ?>
					<input type="submit" name="user-submit" value="<?php _e('Login', 'alethme'); ?>" tabindex="14" class="user-submit" />
					<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
					<input type="hidden" name="user-cookie" value="1" />
				</form>
			</div>

			<div id="regtabs-2">
				<form method="post" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>">
					<input type="text" name="user_login" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login_register" tabindex="101" placeholder="Login" />
					<input type="text" name="user_email" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" id="user_email" tabindex="102" placeholder="E-mail" />

					<?php do_action('register_form'); ?>
					<input type="submit" name="user-submit" value="<?php _e('Register','aletheme'); ?>" class="user-submit" tabindex="103" />
					<?php if(isset($_GET['register']) and $_GET['register'] == "true") { echo '<p>Check your email for the password!</p>'; } ?>
					<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?register=true" />
					<input type="hidden" name="user-cookie" value="1" />
				</form>
			</div>
		<?php } else { ?>
			<div class="logout">
				<a href="<?php echo wp_logout_url('index.php'); ?>"><?php _e('Log out', 'aletheme'); ?></a>
			</div>

			<div class="sidebox">
				<h3><?php _e('Welcome', 'aletheme'); ?>, <?php echo esc_attr($current_user->display_name); ?></h3>
				<div class="user_nav">
					<a href="<?php echo get_edit_user_link($current_user->ID) ?>"><?php _e('Edit Profile in Panel','aletheme'); ?></a><br />
				</div>
			</div>
		<?php }?>
	</div>
</div>