<? include_once("./header.php");?>
<script>
var uri = "http://<?=$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]?>";
var step = 2;
</script>
<body>

	<div id="fbwrap">
		<div id="mainPic2"></div>
		<div id="subPic">
		<? 
		for($i=1;$i<=12;$i++){?>
			<div class="select" data-type="<?=$i?>">
			<img src="./img/<?=$i?>.png" />
			</div>
		<?}?>
		</div>
		
	</div>
	
	<div id="layerPop">
		<div id="bgBlack"></div>
		<div id="bgWhite">
			<div id="pop1">
				<div id="popHead">
				
				<img src="./img/ld2.gif" />
				
				계속하려면 "좋아요"를 누르세요
				</div>
				<div id="popBody">
				
				<!--div class="fb-page" 
				style="margin:10px 0;" 
				data-href="https://www.facebook.com/ssdream16/" 
				data-width="300"
				data-height="70" 
				data-small-header="false" 
				data-adapt-container-width="true" 
				data-hide-cover="false" 
				data-show-facepile="true">
					<blockquote cite="https://www.facebook.com/ssdream16/" 
				class="fb-xfbml-parse-ignore">
					<a href="https://www.facebook.com/ssdream16/">삼성드림이비인후과의원</a>
					</blockquote>
				</div-->
				<div class="fb-like" style="margin:10px auto;" data-href="https://www.facebook.com/ssdream16/" data-width="320" data-layout="standard" data-action="like" data-size="large" data-show-faces="true" data-share="false"></div>
				
				
				</div>
			</div>
		</div>
	</div>
</body>
<script>

$(document).on('click','.select',function(){
	var noseType = $(this).data('type');
	var code;
	$(this).css('backgroundColor','#a88');
	$('#layerPop').fadeIn(200);
	
	var nameset = function(){
		if(typeof FBNAME != 'undefined'){
			$.ajax({
				url : './dbproc.php?',
				type: "POST",
				data:{
					'usertype':noseType,
					'userid':FBID,
					'username':FBNAME,
					'userpic':FBPIC,
					'userage':FBAGE,
					'usergender':FBGENDER
					},
				success: function(response){
					code = response;
					counting();
				},error:function(response){
					alert('서버에 일시적인 장애가 있습니다. 잠시 후 다시 시도해주세요.');
				}
			});
		}else{
			window.setTimeout(nameset, 500);
		}
	}
	nameset();
	
	
	
	var mcount = 8;
	var counting = function(){
		mcount -= 1;
		if(mcount == 0){
			$('#fbwrap, #layerPop').fadeOut(100,function(){ location.href = '/front/event/'+code;});
		}else{
			setTimeout(counting,500);
		}
	}
	
});
</script>
</html>
