<%@ page language="C#" autoeventwireup="true" inherits="CapturePhoto, App_Web_5gjsljb5" masterpagefile="~/Pages/Common/MasterPages/PlainDialogMasterPage.master" title="Capture Photo" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
      

<table border="0" cellpadding="0" cellspacing="0" class="border0" >
    <tr align="center" class="newheadtitle">
        <td align="center" colspan="2" width="300px">
            
            <b>  <u> Live Camera  :</u> </b>
        </td>
        <td class="newheadtitle">
            
            &nbsp &nbsp &nbsp &nbsp &nbsp <u>  </u> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
  <%--          &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
             &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp--%>
            

        </td>
        <td class="newheadtitle">
            
            &nbsp &nbsp &nbsp &nbsp &nbsp <u>  </u> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <b><u>Captured Picture</u> </b>
            &nbsp &nbsp &nbsp &nbsp &nbsp <u>  </u> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
            
            
        </td>
    </tr>

    </table>
    

    <table border="1">
        
    <tr>
        <td>
             &nbsp &nbsp &nbsp &nbsp &nbsp <u>  </u> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp  
            &nbsp &nbsp &nbsp &nbsp &nbsp <u>  </u> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
            &nbsp &nbsp &nbsp &nbsp &nbsp <u>  </u> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
            &nbsp &nbsp &nbsp &nbsp &nbsp <u>  </u> &nbsp &nbsp &nbsp &nbsp

            
            <div id="webcam">
            </div>
        </td>
        <td>
            &nbsp;
        </td>
        <td>
            <asp:Image ID="imgCapture" runat="server" Style="visibility: hidden; width: 320px;height: 240px" />
        </td>
    </tr>
</table>
    



    <table border="0">
        <tr>
            <td>
                 &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp  &nbsp &nbsp &nbsp &nbsp
            
                <asp:Button ID="btnCapture" Text="Capture" runat="server" OnClientClick="return Capture();" SkinID="CustomWidthButton,0" Width="130px" CssClass="PrimaryButton"/>
                 
            &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
                
            </td>
             <td align="center">
                 &nbsp &nbsp
            <asp:Button ID="ClearButton" runat="Server" OnClick="ClearButton_Click" Text="Clear" /> 
           &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
        
        </td>
        <td align="center">
            &nbsp &nbsp &nbsp &nbsp
           <u>      <asp:Button ID="UploadButton" Visible="false" runat="server" Text="Upload" OnClick="UploadButton_Click" OnClientClick="return validate();"/></u>
             &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 
        </td>
        </tr>
    </table>
        
    <br />
<span id="camStatus"></span>
         
 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src='<%=ResolveUrl("~/JavaScript/Webcam_Plugin/jquery.webcam.js") %>' type="text/javascript"></script>
<script type="text/javascript">
    var pageUrl = '<%=ResolveUrl("~/Pages/BaseFramework/Utilities/CapturePhoto.aspx") %>';
    $(function () {

        jQuery("#webcam").webcam({
            width: 320,
            height: 240,
            mode: "save",
            swffile: '<%=ResolveUrl("~/Javascript/Webcam_Plugin/jscam.swf") %>',
        debug: function (type, status) {
            $('#camStatus').append(type + ": " + status + '<br /><br />');
        },
        onSave: function (data) {
            $.ajax({
                type: "POST",
                url: pageUrl + "/GetCapturedImage",
                data: '',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (r) {
                    $("[id*=imgCapture]").css("visibility", "visible");
                    $("[id*=imgCapture]").attr("src", r.d);
                },
                failure: function (response) {
                    alert(response.d);
                }
            });
        },
        onCapture: function () {
            webcam.save(pageUrl);
        }
    });
    });



  <%--  function GetMasterValue() {
        var hy = (document.getElementById('<%=Master.FindControl("DialogHeaderLabel").ClientID %>').innerHTML);
        
        return false;
    }--%>

    function Capture() {

        
        
        webcam.capture();
        return false;
    }

   

  
 

    
</script>
 </asp:Content>
