<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE HTML>
<html lang='ko'> 
<head>
<title></title>
<jsp:include page="/IDC/Header.jsp"></jsp:include>
</head>
<script type="text/javascript">
$(function()
{
	$(document).ready(function()
	{
		//에러있을경우 알려줌
		if($("#reError").val()!="")
			alert($("#reError").val());
		
		var q_addBtn = $("<button>");
		if($("#idc").val()!="")
		{	
			_init(q_addBtn);
		}
	});
	$(document).on("click",".quick_add",function()
	{
		var num = "&num="+($(".quickBtn").length+1);
		var quick ="&quick="+ $(this).attr("value");
		var url = "IdcMemberQuickModify.main?"+num+quick;
		//alert(url);
		window.location=url;		
	});
	$(document).on("click","#qdb",function()
	{
		var num = "&num="+($(this).attr("value"));
		var url = "IdcMemberQuickModify.main?"+num;
		
		window.location=url;
	});
});

var _init=function(btn)
{
	btn.addClass("btn btn-info").attr(
			{
				id : "q_addBtn",
				"data-toggle" : "dropdown"
			}).html("퀵버튼 추가");
	var ul = $("<ul>");
	ul.addClass("dropdown-menu").attr("role", "menu");
	ul.css("background-color", "rgba(255,255,255, 0.8)");

	$.get("IdcGetLinkJSON.jso",function(json)
	{
		var dat = json[0].linkList;
		for(var i=0;i<dat.length;i++)
		{
			var li = $("<li>");
			var a = $("<a>");
			a.addClass("btn btn-default quick_add").html(dat[i].name).attr(
			{
				"vhref" : dat[i].link,
				"value" : dat[i].power
			});
			li.append(a);
			ul.append(li);
		}
		
		var quick = $(".quickBtn");
		//alert(quick.length);
		//for(var i=0;i<15;i++)
		for(var i=0;i<quick.length;i++)	
		{
			var val =$(quick[i]).attr("value");
			var i_val = parseInt(val)-1;
			if(val !="" && val!=null )
			{
				$(quick[i]).attr("href",dat[i_val].link).html(dat[i_val].name);
			}
		}
	});
	
	var ql = $(".quickBtn").length;
	if(ql<25)
		$("#quickBtnDiv").append($("<li>").append(btn).append(ul));	
	if(ql>0)
	{
		quickDelBtn($("#quickBtnDiv"), ql);
	}
}

var quickDelBtn = function(div, ql)
{
	var btn = $("<a>");
	$(btn).html("삭제").addClass("btn btn-danger").attr({"value":ql, "href":"#", "id":"qdb"});
	div.append($("<li>").append(btn));
}
</script>

<style>
.quick1 ul li{
	float:left;
}

</style>
<body>
	<input type="hidden" id="reError" value=${reError }>
	<input type="hidden" id="getUserID">
    <div id="wrapper">
        <!-- Navigation -->
		<jsp:include page="/IDC/Navigation.jsp"></jsp:include>
        <div id="page-wrapper" class="page-wrapper_nor">
			<!-- 1row -->
			<div class="row" style="margin-left:0px;">
	                <div class="col-lg-12" style="margin-left:-55px">
	                <div style="margin-top:8px;"></div>
	                <div class="input-group quick1">
						<div id="mk_quick">
							<ul class="input-group-btn" id="quickBtnDiv">
							<c:if test="${member.quick1!=null }">							
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick1 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick2!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick2 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick3!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick3 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick4!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick4 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick5!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick5 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick6!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick6 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick7!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick7 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick8!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick8 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick9!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick9 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick10!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick10 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick11!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick11 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick12!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick12 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick13!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick13 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick14!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick14 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick15!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick15 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick16!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick16 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick17!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick17 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick18!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick18 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick19!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick19 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick20!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick20 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick21!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick21 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick22!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick22 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick23!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick23 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick24!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick24 }">퀵버튼1</a></li>
							</c:if>
							<c:if test="${member.quick25!=null }">
								<li><a class="btn btn-default quickBtn" href="#" value="${member.quick25 }">퀵버튼1</a></li>
							</c:if>
														
																					
							</ul>
						</div>
                    </div>
					<div style="margin-bottom:5px;"></div>
	                </div>
	                <!-- /.col-lg-12 -->
	            </div>
			<!-- /.row -->
			<!-- 여기에 인클루드 본문 페이지.-->
			<jsp:include page="${TargetFile }"></jsp:include>	      
        </div>
        <!-- /#page-wrapper -->
    </div>
    <!-- /#wrapper -->
	<jsp:include page="/IDC/Footer.jsp"></jsp:include>
</body>
</html>
