<%@ language="javascript" %>
<% /*  $Revision$
       $Id$

    File:               ToonIMG.asp
    Description:
    Parameters:
        ShowButtons     Shows default button set
    Context:
    Note:
*/
%>
<!--#include file="../Shared/common.inc"-->
<!-- #INCLUDE FILE="./SLNKDWF.inc" -->
<%
  FCLTHeader.Requires({ plugins: ["jQuery"],
                        js: ["jquery-ui.js", "./toonimg.js"],
                        css: ["./SLNKDwf.css"]});

var minDLL_VERSION_MAJOR = "3"
var minDLL_VERSION_MINOR = "15"

// Version check
try
{
    var _oAbout = Server.CreateObject('SLNKDWF.About');
    var dllMinor = _oAbout.VersionMinor
    var dllMajor = _oAbout.VersionMajor
    var dllPath = _oAbout.DLLPath;
    var fullPath = "("+Request.ServerVariables('HTTP_HOST') + ')' + dllPath
}
catch (ee)
{
    SLNKDWFError("Unable to activate SLNKDWF.DLL at the webserver.\n" + ee.description);
}
if (typeof(dllMajor) == 'undefined' ||
    dllMajor < minDLL_VERSION_MAJOR ||
    dllMajor == minDLL_VERSION_MAJOR && dllMinor < minDLL_VERSION_MINOR)
{
    SLNKDWFError(fullPath + " is an too old version. v" + minDLL_VERSION_MAJOR + "." + minDLL_VERSION_MINOR + " is required.");
}
%>
<html style="height:100%;">
<head>
    <% FCLTHeader.Generate(); %>
    <script type="text/javascript">
        var SLNKMinMax,lastDWFfile;
        function SLNKAbout()
        {
            var full = window.event && window.event.ctrlKey && window.event.altKey && window.event.shiftKey;
            var version = "SLNKDwf DLL Version: <%=_oAbout.VersionString%>"
                        + "\n\n(c) 2005-2014 Facilitor B.V.";
            if (full)
            {
                version += "\n\n<%=fullPath.replace(/\\/g,'\\\\')%>"
                        +  "\nBuilt: <%=_oAbout.BuildTime%>"
                        +  "\nUsercontext: <%=_oAbout.UserContext.replace(/\\/g,'\\\\')%>"
                if (gSLNKEvent && gSLNKEvent.lastDWFfile)
                    version += "\nLast DWF: " + gSLNKEvent.lastDWFfile;
            }
            if (gSLNKEvent && gSLNKEvent.success)
            {
                var accuracy = 1-(Math.log(gSLNKEvent.scaleX)/Math.log(10));
                var daccuracy = 2+accuracy; // Voor de distance
                if (accuracy<0) accuracy = 0;
                if (daccuracy<0) daccuracy = 0;
                version += "\n\n("+gSLNKEvent.viewminX.toFixed(accuracy)+","+gSLNKEvent.viewminY.toFixed(accuracy) +")";
                version +=   " -("+gSLNKEvent.viewmaxX.toFixed(accuracy)+","+gSLNKEvent.viewmaxY.toFixed(accuracy) + ")";
                version += " ="+(gSLNKEvent.viewmaxX-gSLNKEvent.viewminX).toFixed(accuracy)+"x"+
                                (gSLNKEvent.viewmaxY-gSLNKEvent.viewminY).toFixed(accuracy);
            }
            alert(version);
        }

       function setPanMode(panmode, pthis)
       {
          SetPanMode(panmode);
         setActive(pthis.id);
       }

       function setActive(pid)
       {
          // reset alle bekende buttons
          $("#navbuttons img").removeClass("imgdown").addClass("imgup");
          // en set de ene
          $("#"+pid).removeClass("imgup").addClass("imgdown");
       }
       function isDwfViewerInstalled ()
       {
        	var bFound = false;
            try
            {
                var objViewer = new ActiveXObject("AdView.AdViewer");
                bFound = true;
            }
            catch ( e )
            {
        		//Failed to create object, viewer not installed
            }
            return bFound;
       }

       function enableEviewPrint()
       {
            setActive("ImgArrow");
            if (isDwfViewerInstalled())
            {
                $("#ImgPrintEV").show();
            }
       }
    </script>
</head>
<%
    var evtres = "onresize=\"scheduleRefresh()\"";
    var agent = String(Request.ServerVariables("HTTP_USER_AGENT"));
    if (agent.indexOf("iPad") != -1)
        evtres = ""; // geeft ongewenste resize bij uitzoomen

%>
<body id="idBody" name="idBody" onload="enableEviewPrint();Init();Reset();" <%=evtres%>
        style="background-color:white;margin:0;padding:0;"
        onmouseleave="_onMouseLeave(event)"
        onselect="document.selection.empty();"
        onkeydown="return _onKeyDown(event)">
    <div id="rubberBand" onclick="_stopRubber(event)" onmousemove="_moveRubber(event);"
                onmouseup="_onMouseUp(event);" oncontextmenu="return _oncontextmenu(event);">
    </div>
    <div id="dist" onclick="_stopRubber(event)" onmousemove="_moveRubber(event);"></div>
    <div id="dwgDist" style="z-index:4" onmousemove="_onMouseMove(event);">Hier komt de afstand</div>
    <div id="DragAndDrop" onMouseMove="Dropper_onMouseMove(event)" onMouseUp="Dropper_onMouseUp(event)">
             Hier komt de drag-and-drop HTML
    </div>

<% if (Request.QueryString("ShowButtons").Count>0) { %>
    <div id="navbuttons" style="position:absolute;z-index:1;">
      <img    id="ImgRefresh" src="./images/refresh.png"
             alt="Refresh Window"
           title="Refresh Window"
         onClick= "javascript:Refresh(false,true)"
      >
      <img    id="ImgArrow" src="./images/arrow.png"
             alt="Info"
           title="Info"
         onClick="javascript:setPanMode(1,this)"
      >
<% if (false) {%>
      <img    id="ImgPan" src="./images/pan.png"
             alt="Pan"
           title="Pan"
         onClick= "javascript:setPanMode(0)"
      >
<% } %>
      <img    id="ImgZoomWin" src="./images/zoomwin.png"
             alt="Zoom Window"
           title="Zoom Window"
         onClick= "javascript:setPanMode(2, this)"
      >
      <img    id="ImgZoomOut" src="./images/zoomout.png"
             alt="Zoom Out"
           title="Zoom Out"
         onClick= "javascript:setPanMode(3, this)"
      >
      <img    id="ImgZoomExtents" src="./images/zoomextents.png"
             alt="Zoom Extents"
           title="Zoom Extents"
         onClick= "javascript:ZoomExtents(event);"
      >
      <img    id="ImgPrint" src="./images/print.png"
             alt="Print"
           title="Print"
         onClick= "javascript:onPrint(event)"
      >
      <img    id="ImgPrintEV" src="./images/printEV.png"
             alt="Print using Autodesk Viewer"
           title="Print using Autodesk Viewer"
         onClick= "javascript:onPrintEv(event)"
         style="display:none;"
      >
    </div>
    <% } %>
    <div id="defaultContextMenu" class="slnkmenu" style="display:none">
        <div class="menuItem" style="margin-top:5px" monClick="Refresh()">Refresh</div>
        <div class="menuItem" monClick="SetPanMode(1)">Select</div>
        <hr>
        <div class="menuItem" monClick="SetPanMode(0)">Pan</div>
        <div class="menuItem" monClick="SetPanMode(2)">Zoom rectangle</div>
        <div class="menuItem" monClick="SetPanMode(3)">Zoom out</div>
        <div class="menuItem" monClick="ZoomExtents()">Fit to Window</div>
        <hr>
        <div class="menuItem" monClick="SetPaperColor(0);Refresh();">Background black</div>
        <div class="menuItem" monClick="SetPaperColor(0xFFFFFF);Refresh()">Background white</div>
<% if (Request.QueryString("ShowLabelMenu").Count>0) { %>
        <hr>
        <div class="menuItem" monClick="SetLabelPosition(1);Refresh();">Label position default</div>
        <div class="menuItem" monClick="SetLabelPosition(2);Refresh();">Label position center</div>
        <div class="menuItem" monClick="SetLabelPosition(3);Refresh();">Label position topleft</div>
<% } %>
        <hr>
        <div class="menuItem" monClick="onPrint();">Print</div>
        <div class="menuItem" monClick="_CopyToClip('Eview');">Copy</div>
        <hr>
        <div class="menuItem" style="margin-bottom:5px" monClick="SLNKAbout()">About SLNKDwf</div>
    </div>
    <div id="Pickpoint" ondragstart="return false;"
        onmouseover="_PickHot(event)" onmouseout="_PickCold(event)" onmousedown="return _onMouseDown(event)"
        oncontextmenu="return _onPickcontextmenu(event)"
    >
    </div>
    <div id=Snapper></div>

    <img id="busymarker" src="images/busy.gif">
    <img id="Eview" galleryimg="false" usemap="#SystemMap"
         style="width:100%;height:100%;position:absolute;z-index:0;"
     >
    <map id="SystemMap" name="SystemMap"
         onmouseover="_areain(event);"
         onmouseout="_areaout(event)"
    >
    </map>
</body>
</html>
