<?php 
$g['use_social'] = is_file($g['path_module'].'social/var/var.php');
if ($g['use_social']) include $g['path_module'].'social/var/var.php';
?>

<div id="loginBox">
	<form name="showLogBoxForm" action="<?php echo $d['admin']['ssl_type']?$g['ssl_root']:$g['url_root']?>/" method="post"  onsubmit="return showLogCheck(this);">
	<input type="hidden" name="r" value="<?php echo $r?>" />
	<input type="hidden" name="a" value="login" />
	<input type="hidden" name="referer" value="" />
	<input type="hidden" name="__target" value="_parent" />

	<fieldset>
		<label> 
		<div>이메일 또는 아이디</div>
		<input type="text" name="id" class="xi" id="_xi_1" autocomplete="on" value="<?php echo getArrayCookie($_COOKIE['svshop'],'|',0)?>" />
		</label>
		<label> 
		<div>비밀번호</div>
		<input type="password" name="pw" class="xi" id="_xi_2" value="<?php echo getArrayCookie($_COOKIE['svshop'],'|',1)?>" />
		</label>
		<div class="submit">
		<label>
		<input type="checkbox" name="idpwsave" value="checked"<?php if($_COOKIE['svshop']):?> checked="checked"<?php endif?> />
		<span>아이디/비밀번호 기억</span>
		</label>
		<label>
		<input type="checkbox" name="gohub" value="Y" />
		<span>마이페이지로 이동</span> 
		</label>
		</div>
		<input type="submit" id="_login_btn_" class="btnblue" value="로그인" />
	</fieldset>
	</form>



		<div id="__sns__login__" class="snslog">
			<div class="tt">소셜 로그인</div>
			<div class="social-buttons">
			<?php $socialProviders=array('naver'=>'N','google'=>'G','facebook'=>'f','x'=>'X'); foreach($socialProviders as $socialKey=>$socialMark):?>
			<button type="button" class="social-btn social-<?php echo $socialKey?><?php if(empty($d['social']['use_'.$socialKey])):?> disabled<?php endif?>" title="<?php echo $socialKey?> 로그인" onclick="socialLogin('<?php echo $socialKey?>',<?php echo empty($d['social']['use_'.$socialKey])?'false':'true'?>);"><span><?php echo $socialMark?></span></button>
			<?php endforeach?>
			</div>
			<div class="guide">네이버, 구글, 페이스북 또는 X 계정으로 간편하게 로그인할 수 있습니다.</div>
		</div>
</div>

<script type="text/javascript">
//<![CDATA[
function showLogCheck(f)
{
	if (f.id.value == '')
	{
		alert('아이디나 이메일을 입력해 주세요.');
		f.id.focus();
		return false;
	}
	if (f.pw.value == '')
	{
		alert('비밀번호를 입력해 주세요.');
		f.pw.focus();
		return false;
	}
	if (f.gohub.checked == true)
	{
		f.referer.value = "<?php echo $g['s']?>/?r=<?php echo $r?>&mod=mypage";
	}
	else {
		f.referer.value = '<?php echo urldecode($referer)?>';
	}
	return true;
}
	function socialLogin(provider,enabled)
	{
		if (!enabled)
		{
			alert('관리자가 아직 이 소셜 로그인을 설정하지 않았습니다.');
			return false;
		}
		var url = rooturl+'/?r='+raccount+'&m=social&page=oauth&provider='+encodeURIComponent(provider);
		window.open(url,'jusq_social_login','width=620,height=720,statusbar=no,scrollbars=yes,toolbar=no');
	}

window.onload = function()
{
	var doHide = 0; // 소셜로그인 숨김 = 1 / 보이기 = 0

	parent.getId('_modal_on_').style.overflow = 'hidden';
	parent.getId('_modal_on_').style.width = '520px';
	parent.getId('_modal_on_').style.height = '250px';

	<?php if(!$g['use_social']):?>
	if (doHide)
	{
		parent.getId('_modal_on_').style.width = '325px';
		parent.getId('_modal_on_').style.height = '270px';
		getId('loginBox').style.padding = '20px 0 0 30px';
		getId('_xi_1').style.width = '220px';
		getId('_xi_2').style.width = '220px';
		getId('_login_btn_').style.left = '182px';
		getId('__sns__login__').style.display = 'none';
	}
	<?php endif?>
}
//]]>
</script>
