<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ page import="com.csc.library.system.*,com.csc.library.utilities.*"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*"  %>
<% request.setCharacterEncoding("UTF-8"); %>
<%@ include file="../CHECKPROFILE.jsp" %>

<jsp:useBean id="EMVVDO" class="com.csc.library.system.Task" scope="page" />

<%
	EMVVDO.setChannel(request,response);
	EmvHelpEntry screenVDO = (EmvHelpEntry)EMVVDO.process("EmvHelpEntry","TVIDEOHELP");
	String myfilter=" (branchid = 'All' OR branchid = '"+screenVDO.getUProfile().get("branch")+"') AND status= '1' AND companyid = '"+screenVDO.getUProfile().get("companyid")+"'";
	screenVDO.inq.setFilter(myfilter);
	screenVDO.inq.setOrderBy("preseq,edit_date desc, edit_time desc");
	screenVDO.inq.refresh();
	screenVDO.nextRec();
%>

<!DOCTYPE HTML>
<html>
	<head>
		<title>Employee View</title>
		<style>
			.control-label-form{
				font-size:12px !important;
			}
		</style>
	</head>
	<body>
		<div class="bg-com"></div>
		<jsp:include page="EMV_HEADMENU.jsp" flush="true" />
		
		<section>
			<%
				screenVDO.referLangOn();
			%>
			<%
				if(screenVDO.inq.recCount()>0){
			%>
			<div class="center">
				<iframe name="Mainvdo" width="620" height="300" src="<%=screenVDO.getString("link")%>" frameborder="0" allowfullscreen></iframe>		
			</div>
			</br>

			<div class="container">	
				<div class="vdo-content">
					<img class="picY" width="220" src="" data-src="<%=screenVDO.getString("link")%>"></img>
					<div class="control-label-form" name="title" data-title="<%=screenVDO.getString("link")%>"><b><%=screenVDO.getString("ETITLE")%></div>
				</div>
				<%
					while(screenVDO.nextRec()){				
				%>
				<div class="vdo-content">
					<img class="picY" width="220" src="" data-src="<%=screenVDO.getString("link")%>"></img>
					<div class="control-label-form" name="title" data-title="<%=screenVDO.getString("link")%>"><b><%=screenVDO.getString("ETITLE")%></b></div>
				</div>
				<%}%>

			</div>
				<%}%>
		</section>

		<jsp:include page="FOOTER.jsp" flush="true" />

		<script type="text/javascript">
			$(document).ready(function(){

				var firstl = $("iframe[name=Mainvdo]").attr("src");
				firstl = firstl.substring(firstl.lastIndexOf("?v=")+3,firstl.length);
				 $("iframe[name=Mainvdo]").attr("src","https://www.youtube.com/embed/"+firstl);	
		
				$(".picY").each(function(){
					var mysrc = $(this).data("src");
					mysrc = mysrc.substring(mysrc.lastIndexOf("?v=")+3,mysrc.length);
									
					$(this).attr("src","//i.ytimg.com/vi/"+mysrc+"/default.jpg");
				});

				$(".picY").click(function(){
					var cutsrc = $(this).data("src");
					cutsrc = cutsrc.substring(cutsrc.lastIndexOf("?v=")+3,cutsrc.length);
					$("iframe[name=Mainvdo]").attr("src","https://www.youtube.com/embed/"+cutsrc);
				});

				$("span[name=title]").click(function(){
					var cuttitle = $(this).data("title");
					cuttitle = cuttitle.substring(cuttitle.lastIndexOf("?v=")+3,cuttitle.length);
					$("iframe[name=Mainvdo]").attr("src","https://www.youtube.com/embed/"+cuttitle);
				});

			});
		</script>
	</body>
</html>