<?php
$this->load_template('_home-header.php');
$this->load_template('_top.php');
?>
<script src="<?php echo $C->SITE_URL ?>themes/<?php echo $C->THEME ?>/js/js_login.js"></script>
<script src="<?php echo $C->SITE_URL ?>themes/<?php echo $C->THEME ?>/js/js_register.js"></script>
<script src="<?php echo $C->SITE_URL ?>themes/<?php echo $C->THEME ?>/js/md5.js"></script>
<div id="msgTopHome">
	<div id="container">
        <div class="centered"><img src="<?php echo $C->SITE_URL.'themes/'.$C->THEME?>/imgs/logo-home.png"></div>
        <div id="topmsg" class="centered">
            <div id="line01"><?php echo $this->lang('home_msg_line1')?></div>
        </div>
    </div>
</div>

<div id="sectionLogin">
	<div id="container">
    	
		
        <div id="boxHome">
            <?php if ($C->LOGIN_WITH_FACEBOOK || $C->LOGIN_WITH_TWITTER || $C->LOGIN_WITH_VK) { ?>
        	<div><span class="mrg20L white txtshadow"><?php echo $this->lang('home_txt_connectwith')?>:</span></div>
        	<div class="mrg10T">
            	<?php if ($C->LOGIN_WITH_FACEBOOK) { ?>
            	<a href="<?php echo $D->fb_loginUrl; ?>" class="undecorated" title="<?php echo $this->lang('home_msg_btfb')?>"><span class="mrg20L"><img src="<?php echo $C->SITE_URL.'themes/'.$C->THEME ?>/imgs/ico-login-fb.png"></span></a>
                <?php } ?>
                
                <?php if ($C->LOGIN_WITH_TWITTER) { ?>
                <a href="<?php echo $C->SITE_URL; ?>oauthtwitter" class="undecorated" title="<?php echo $this->lang('home_msg_bttw')?>"><span class="mrg10L"><img src="<?php echo $C->SITE_URL.'themes/'.$C->THEME ?>/imgs/ico-login-tw.png"></span></a>
                <?php } ?>
                
                <?php if ($C->LOGIN_WITH_GPLUS) { ?>
                <a href="<?php echo $C->SITE_URL; ?>oauthgplus" class="undecorated" title="<?php echo $this->lang('home_msg_btgp')?>"><span class="mrg10L"><img src="<?php echo $C->SITE_URL.'themes/'.$C->THEME ?>/imgs/ico-login-gp.png"></span></a>
                <?php } ?>
                
				<?php if ($C->LOGIN_WITH_LINKEDIN) { ?>
                <a href="<?php echo $C->SITE_URL; ?>oauthlinkedin" class="undecorated" title="<?php echo $this->lang('home_msg_btin')?>"><span class="mrg10L"><img src="<?php echo $C->SITE_URL.'themes/'.$C->THEME ?>/imgs/ico-login-in.png"></span></a>
                <?php } ?>

				<?php if ($C->LOGIN_WITH_YAHOO) { ?>
                <a href="<?php echo $C->SITE_URL; ?>oauthyahoo" class="undecorated" title="<?php echo $this->lang('home_msg_btyh')?>"><span class="mrg10L"><img src="<?php echo $C->SITE_URL.'themes/'.$C->THEME ?>/imgs/ico-login-yh.png"></span></a>
                <?php } ?>
                
                <?php if ($C->LOGIN_WITH_VK) { ?>
                <a href="<?php echo $C->SITE_URL; ?>oauthvk" class="undecorated" title="<?php echo $this->lang('home_msg_btvk')?>"><span class="mrg10L"><img src="<?php echo $C->SITE_URL.'themes/'.$C->THEME ?>/imgs/ico-login-vk.png"></span></a>
                <?php } ?>
            </div>
            
            <div class="mrg20L mrg20T white txtshadow">Or</div>
            <?php } ?>
        
            <div id="areabotton" class="centered">
            
                <div class="beml btlog"><?php echo $this->lang('home_msg_bteml')?></div>
                
                <div id="lnklogin" class="benter btlog mrg20T"><?php echo $this->lang('home_msg_txtlogin')?></div>

            </div>
        </div>
        
        <div id="tryLogin">

            <div id="arealogin">
            	<div id="xarealg" style="float:right; cursor:pointer; color:#FFF; font-weight:bold; text-shadow:0 0 10px #000;">x</div>
            	<div class="titlelogin mrg20B"><?php echo $this->lang('home_f_login_tl'); ?></div>
                <form id="formlogin" name="formlogin" method="post">
                <div class="pdn10R"><input type="text" name="usernamel" id="usernamel" class="form-control" placeholder="<?php echo $this->lang('home_f_login_un')?>"></div>
                <div class="pdn10R mrg10T"><input type="password" name="passwordl" id="passwordl" class="form-control" placeholder="<?php echo $this->lang('home_f_login_pw')?>"></div>
                <div id="errorlogin" class="alert-error mrg10T pdn10 centered hide"></div>
                <div class="mrg10T">
                    <div class="fleft"><button id="btlogin" name="btlogin" type="submit" class="btn btn-sky"><?php echo $this->lang('home_f_login_bt')?></button></div>
                    <div id="linkrecovery" class="fright mrg10T white mrg5T hand"><?php echo $this->lang('home_f_recovery_txtlink')?></div>
                    <div class="sh"></div>
                </div>
                </form>
            </div>
            
            <div id="arearecovery" class="hide">
            	<div id="xarearec" style="float:right; cursor:pointer; color:#FFF; font-weight:bold; text-shadow:0 0 10px #000;">x</div>
            	<div class="titlerecv mrg20B"><?php echo $this->lang('home_f_recovery_txtlink'); ?></div>
                <form id="formrecovery" name="formrecovery" method="post">
                <div class="pdn10R"><input type="text" name="emailrecovery" id="emailrecovery" class="form-control" placeholder="<?php echo $this->lang('home_f_recovery_inputemail')?>"></div>
                <div id="errorrecovery" class="alert-error mrg10T pdn10 centered hide"></div>
                <div id="okrecovery" class="alert-success mrg10T pdn10 centered hide"></div>
                <div class="mrg10T">
                    <div><button id="btrecovery" name="btrecovery" type="submit" class="btn btn-orange"><?php echo $this->lang('home_f_recovery_brecovery')?></button></div>
                    
                    <div class="sh"></div>
                </div>
                </form>
            </div>

        </div>
        
        <div id="tryRegister">

            <div id="areasignup" class="mrg20B">
            	<div id="xareasgnu" style="float:right; cursor:pointer; color:#FFF; font-weight:bold; text-shadow:0 0 10px #000;">x</div>
                <div class="titlesignup mrg10B"><?php echo $this->lang('home_f_signup_tl');?></div>
                <form id="formregister" name="formregister" method="post">
                <div class="pdn10R"><input type="text" name="email" id="email" class="form-control" placeholder="<?php echo $this->lang('home_f_signup_em')?>"></div>
                <div class="pdn10R mrg10T"><input type="text" name="usernamer" id="usernamer" class="form-control" placeholder="<?php echo $this->lang('home_f_signup_un')?>"></div>
                <div class="pdn10R mrg10T"><input type="password" name="passwordr" id="passwordr" class="form-control" placeholder="<?php echo $this->lang('home_f_signup_pw')?>"></div>
                <div class="mrg10T">
                    <?php echo getCaptcha()?>
                    <div><input type="text" name="captcha" id="captcha" class="form-control width50c" placeholder="<?php echo $C->ctcha1?> + <?php echo $C->ctcha2?>"></div>
                    <div class="sh"></div>
                </div>
                <div id="errorsignup" class="alert-error mrg10T pdn10 centered hide"></div>
                <div class="mrg10T">
                    <div><button id="btsignup" name="btsignup" type="submit" class="btn btn-green"><?php echo $this->lang('home_f_signup_bt')?></button></div>
                    
                    <div class="sh"></div>
                </div>
                </form>
            </div>
            
            <div id="registerok" class="hide"></div>

        </div>
        
        
    </div>
    
</div>
<div class="sh"></div>

<?php
$miniuser = array();
for($i = 0; $i < $D->numuserAleat; $i++) {
	$miniuser[$i]='';
	if (isset($D->userAleat[$i])) $miniuser[$i]='<a href="'.$C->SITE_URL.$D->userAleat[$i]->username.'"><img src="'.$C->SITE_URL.$C->FOLDER_AVATAR.'min2/'.(empty($D->userAleat[$i]->avatar)?$C->AVATAR_DEFAULT:$D->userAleat[$i]->avatar).'"></a>';
}
?>

<div id="container">
    <div id="usersAleatHome">
        
        <div class="mrg20T mrg10B">
            <?php for($i = 0; $i < $D->numuserAleat; $i++) { ?>
            <div class="spacephoto">
                <div class="oneminiphoto"><?php echo $miniuser[$i]?></div>
            </div>
            <?php } ?>
            <div class="sh"></div>
        </div>
        
    </div> 
    
    <div class="sh"></div>
    
</div>

<script>
	img = 'url(<?php echo $C->SITE_URL.$C->FOLDER_BGHOME.$C->BGHOME01?>)';
	var styles = {
      'background-image': img,
    };
	$('.backhome').css(styles);

	$("#lnklogin").click(function(){
		$('#boxHome').slideUp('slow', function(){
			$('#tryLogin').slideDown('slow');
		});
		return false;
	});	

	$("#xarealg").click(function(){
		$('#tryLogin').slideUp('slow', function(){
			$('#boxHome').slideDown('slow');
		});
		return false;
	});	
	
	$('#xarearec').click(function(){
		$('#arearecovery').slideUp('slow', function(){
			$('#arealogin').slideDown('slow');
		});
		return false;
	})
	
	$(".beml").click(function(){
		$('#boxHome').slideUp('slow', function(){
			$('#tryRegister').slideDown('slow');
		});
		return false;
	});	
	
	$("#xareasgnu").click(function(){
		$('#tryRegister').slideUp('slow', function(){
			$('#boxHome').slideDown('slow');
		});
		return false;
	});
	
	var rtxterror1 = '<?php echo $this->lang('home_f_signup_error1')?>';
	var rtxterror2 = '<?php echo $this->lang('home_f_signup_error2')?>';
	var rtxterror3 = '<?php echo $this->lang('home_f_signup_error3')?>';
	var rtxterror4 = '<?php echo $this->lang('home_f_signup_error4')?>';
	var rtxterror5 = '<?php echo $this->lang('home_f_signup_error8')?>';
	$('#btsignup').click(function(){
		actionRegister('#btsignup', '#errorsignup', '#areasignup', '#registerok');
		return false;
	})	
	
	var ltxterror1 = '<?php echo $this->lang('home_f_login_error1')?>';
	var ltxterror2 = '<?php echo $this->lang('home_f_login_error2')?>';
	var ltxterror3 = '<?php echo $this->lang('home_f_login_error3')?>';
	var ltxterror4 = '<?php echo $this->lang('home_f_login_error4')?>';
	var txtconnerror = '<?php echo $this->lang('home_f_txtconnerror')?>';
	$('#btlogin').click(function(){
		actionLogin('#btlogin', '#errorlogin');
		return false;
	})
	
	$('#linkrecovery').click(function(){
		$('#arealogin').slideUp('slow', function(){
			$('#arearecovery').slideDown('slow');
		});
		return false;
	})
	
	var recvtxterror1 = '<?php echo $this->lang('home_f_recovery_error1')?>';
	$('#btrecovery').click(function(){
		actionRecovery('#btrecovery', '#errorrecovery', '#okrecovery');
		return false;
	})	

</script>

<div id="container">
<?php
$this->load_template('_home-foot.php');
?>
</div>
<?php
$this->load_template('_footer.php');
?>