<script src="$jsdir/wz_dragdrop.js"></script>
!set DHTML=$empty
!if $draw=1
    !set insdraw_size=$(image_settings$n)
!else
    !if $plot=1
	!set insplot_set=$(image_settings$n)
    !endif
!endif

<table id="exercise" class="exercise" >
    <tr>
    <td class="exercise_t">
	$(question$n)
	!if $exotext!=$empty
	    <br />
	    $exotext
	!endif
    </td>
    </tr>
    <tr>
    <td class="exercise_t">
	<table class="exercise">
	    <tr>
	    <td class="exercise_m">
		<table class="exercise">
		    <tr>
		    !for p=1 to $options
			<td style="background-color:#82bbff">
			    <div id="div$p" style="position:relative;border:2px solid red;width:$[$xsize+2];height:$[$ysize+2]">
				!if $multiimage=1
				    !if $draw=1
					!insdraw $(ex$p)
				    !else
					!if $plot=1
					    !insplot $(ex$p)
					!endif
				    !endif
				!else
				    !if $math=0
					$(ex$p)
				    !else
					!insmath $(ex$p)
				    !endif
				!endif
			    </div>
			    !set DHTML=!append item "div$p" to $DHTML
			</td>
			!if $make_tr=1
			    <tr>
			!endif
		    !next p
			<td style="background-color:#ff1338">
			    <div id="dontknow" style="position:relative;border:thin solid blue;width:$xsize;heigth:$ysize">
				<span class="schaersvoorde_alarm">$dontknow</span>
			    </div>
			    !set DHTML=!append item "dontknow" to $DHTML
			</td>
		    </tr>
		</table>
	    </td>
	    <td class="exercise_m">
		<div id="target" style="background-color:#60ff71;padding:2px; border:thin solid green; margin:2px;width:$xsize;heigth:$ysize">
		    !if $(formula$n) != $empty
			!insmath $(formula$n)
		    !else
			!if $image=1
			    !if $(image$n)!=$empty
				!if $draw=1
				    !set insdraw_size=$xsize,$ysize
				    !insdraw $(image$n)
				!else
				    !set insplot_set=$(image_settings$n),size $xsize,$ysize
				    !insplot $(image$n)
				!endif
			    !endif
			!else
			    <img src="$jsdir/transparentpixel.gif" width="$xsize" height="$ysize" alt="no alt" />
			!endif
		    !endif	
		    !set DHTML=!append item "target" to $DHTML
    		</div>
	    </td>
	    </tr>
	</table>
    </td>
    </tr>
</table>

<script>
    SET_DHTML( CURSOR_MOVE , $DHTML);
</script>
<script>
    function my_DropFunc(){
	var delta=100;
	var X=dd.elements.target.x;
	var Y=dd.elements.target.y;
        var answer=dd.obj.id;
	var x=dd.obj.x;
        var y=dd.obj.y;
	if(x<X+delta && x>X-delta && y>Y-delta && y<Y+3*delta){
	    dd.obj.moveTo(X,Y);
	    if(answer == "dontknow"){answer="%3F";}
	    answer=answer.replace(/div/g,'');
	    var URL = '$wims_refname?session=$session&module=$module&cmd=reply&+reply$n='+answer
	    document.location.href = URL;
	    !if $debug=1
		alert('developerdebug: div-element no '+answer);
	    !endif
	}
	else
        {
    	    dd.obj.moveTo(dd.obj.defx,dd.obj.defy);
	}
	dd.obj='null';
    }
</script>
