<!-- BEGIN reload_tree -->
<script language="JavaScript" type="text/javascript">
parent.tree.location.replace('{LINK_TREE}');
</script>
<!-- END reload_tree -->
<form action="{FORMACTION}" name="objectItems" method="post">
<table class="fullwidth">
<tr class="std">
<td class="submit">
{SEL_MEDIA_MODE} {SEL_JAVA_SCRIPT} {SEL_HTML_MODE}<input class="ilEditSubmit" type="submit" value="{TXT_CHANGE_EDIT_MODE}" name="cmd[setMediaMode]" />
<!-- BEGIN de_activate_page -->
<input type="submit" class="ilEditSubmit" value="{TXT_DE_ACTIVATE_PAGE}" name="cmd[{CMD_DE_ACTIVATE_PAGE}]" />
<!-- END de_activate_page -->
<span class="small">{TXT_JAVA_SCRIPT_CAPABLE}</span>
</td>
<!-- BEGIN view_link -->
<td class="submit" align="right">
<a class="submit" href="{LINK_VIEW_PAGE}" target="{TARGET_VIEW_PAGE}">{TXT_VIEW_PAGE}</a>
</td>
<!-- END view_link -->
</tr>
</table>
<table class="ilc_Page" width="100%" cellspacing="0" cellpadding="0"><tr><td class="{CLASS_PAGE_TD}">
{PAGE_CONTENT}
</td></tr>
</table>
<table class="fullwidth">
<!-- BEGIN multi_actions -->
<tr><td class="submit">
<img border="0" src="{IMG_ARROW}" style="vertical-align:middle;"/>
<input class="submit" type="submit" value="{TXT_DELETE_SELECTED}" name="cmd[deleteSelected]">
<input class="submit" type="submit" value="{TXT_DE_ACTIVATE_SELECTED}" name="cmd[activateSelected]">
</td></tr>
<!-- END multi_actions -->
<!-- BEGIN med_link -->
<tr class="std">
<td class="submit">
<b>{TXT_LINKED_MOBS}</b> {SEL_MED_LINKS} <input class="submit" type="submit" value="{TXT_EDIT_MEDIA}" name="cmd[editLinkedMedia]">
<input class="submit" type="submit" value="{TXT_COPY_TO_CLIPBOARD}" name="cmd[copyLinkedMediaToClipboard]">
</td>
</tr>
<!-- END med_link -->
<!-- BEGIN change_comment -->
<tr class="std">
<td class="submit">
<textarea rows="4" cols="60" width="95%" name="change_comment"></textarea>
<br /><input class="submit" style="margin: 3px 0px;" type="submit" value="{TXT_ADD_COMMENT}" name="cmd[addChangeComment]">
</td>
</tr>
<!-- END change_comment -->
</table>
</form>


<script language="JavaScript" type="text/javascript">
var stopHigh = false;
var borderStore = new Array();

/**
*   On mouse over highlight the current block with colored border.
*/
function doMouseOver(id) 
{
	if(stopHigh) return;
	stopHigh=true;
	overId = id;
	setTimeout("stopHigh=false",10);
	
	if (document.getElementById) 
	{
		obj = document.getElementById(id);
		borderStore[id] = obj.style.border;
		obj.style.border = "solid green 1px";
	} 
	else if(document.layers)
	{
		obj = eval("document."+id);
		borderStore[id] = obj.border;
		obj.border = "solid green 1px";
	}
}

/**
*   On mouse out turn highligh of current border off
*/
function doMouseOut(id, dotted) 
{
	if (id!=overId) return;
	stopHigh = false;
    if (document.getElementById) 
	{
        obj = document.getElementById(id);
		if(dotted == true)
		{
			obj.style.border = borderStore[id];
			/* obj.style.border="dotted gray 1px"; */
		}
		else
		{
			obj.style.border="0px";
		}
    } else if(document.layers)
	{
        obj = eval("document."+id);
		obj.border = borderStore[id];
        /* obj.border="solid gray 1px"; */
    }
}

var dragDropShow = false;
var mouseIsDown = false;
var mouseDownBlocked = false;
var mouseUpBlocked = false;
var Mposx = 0;
var Mposy = 0;

var dragId = "";
var overId = "";

function doMouseDown(id) 
{
	//dd.elements.contextmenu.hide();
	if(mouseDownBlocked) return;
	mouseDownBlocked = true;
	setTimeout("mouseDownBlocked = false;",200);
	
	if (!mouseIsDown) {
		dragId = id;
	
		oldMposx = Mposx;
		oldMposy = Mposy;
		mouseIsDown = true;
	}
}

function beginDrag() 
{
	dd.elements.dragdropsymbol.show();
	dragDropShow = true;
	moveDragDropSymbol();
}

var cmd1 = "";
var cmd2 = "";
var cmd3 = "";
var cmd4 = "";

function callBeforeAfterAction(setCmd3) 
{
	cmd3 = setCmd3;
	doActionForm(cmd1, cmd2, cmd3, cmd4);
}


function doMouseUp(id) 
{
	if (dragDropShow)
	{
		if(mouseUpBlocked) return;
		mouseUpBlocked = true;
		setTimeout("mouseUpBlocked = false;",200);
		
		// mousebutton released over new object. call moveafter
		//alert(dragId+" - "+overId);
		DID = overId.substr(7);
		OID = dragId.substr(7);
		if (DID != OID) 
		{ 
			doCloseContextMenuCounter = 20;
			openedMenu = "movebeforeaftermenu";
			dd.elements.movebeforeaftermenu.moveTo(Mposx,Mposy);
			dd.elements.movebeforeaftermenu.show();
			cmd1 = 'cmd[exec_'+OID+']';
			cmd2 = 'command'+OID;
			cmd3 = 'moveAfter';
			cmd4 = DID;
			//doActionForm('cmd[exec_'+OID+']','command'+OID+'', 'moveAfter', DID);
		}
	}
	dragId = "";
	mouseIsDown = false;
	dragDropShow = false;
	dd.elements.dragdropsymbol.hide();
	dd.elements.dragdropsymbol.moveTo(-1000,-1000);
	setTimeout("dragDropShow = false",500);
	
}

function moveDragDropSymbol() 
{
	
	if (dragDropShow) 
	{
		dd.elements.dragdropsymbol.moveTo(Mposx+5,Mposy-5);
	}
	//setTimeout("moveDragDropSymbol()",100);
}
//setTimeout("moveDragDropSymbol()",1000);

/**
*   on Click show context-menu at mouse-position
*/

var menuBlocked = false;
function nextMenuClick() {
	menuBlocked = false;
}

var openedMenu="";
function doMouseClick(e,id,ctype) 
{
	// dies ist n�tig, weil wenn zwei Layer �bereinander liegen von beiden ein Event ausgel�st wird.
	// Jetzt wird aber bei einem Klick das Men� geblockt f�r einen halbe sekunde.
	if(menuBlocked || mouseUpBlocked) return;
	menuBlocked = true;
	setTimeout("nextMenuClick()",100);
	
	if (!e) var e = window.event;
	
	clickcmdid = id.substr(7);
	
	if (e.pageX || e.pageY)
	{
		Mposx = e.pageX;
		Mposy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		Mposx = e.clientX + document.body.scrollLeft;
		Mposy = e.clientY + document.body.scrollTop;
	}
	if (!dragDropShow) 
	{
	
		oldOpenedMenu = "-";
		if (openedMenu!="") 
		{
			dd.elements[openedMenu].hide();
			oldOpenedMenu = openedMenu;
			openedMenu = "";
			
		} 
		
		openedMenu = "contextmenu_"+clickcmdid;
		if (oldOpenedMenu != openedMenu)  
		{
			dd.elements[openedMenu].moveTo(Mposx,Mposy-10);
			dd.elements[openedMenu].show();
			
		}
		doCloseContextMenuCounter=20;
	}
}

/**
*   on MouseOut of context-menu hide context-menu 
*/
var doCloseContextMenuCounter = -1;
function doCloseContextMenu() 
{
	if (doCloseContextMenuCounter>-1) 
	{
		doCloseContextMenuCounter--;
		if(doCloseContextMenuCounter==0) 
		{
			if(openedMenu!="") 
			{
				dd.elements[openedMenu].hide();
				openedMenu = "";
			}
			doCloseContextMenuCounter=-1;
		}
	}
	setTimeout("doCloseContextMenu()",100);
}
setTimeout("doCloseContextMenu()",200);

var clickcmdid = 0;
function doActionForm(cmd, command, value, target)    
{
    doCloseContextMenuCounter = 2;
    if(cmd=="cmd[exec]") 
	{
        cmd = "cmd[exec_"+clickcmdid+"]";
    }
    
    if (command=="command") 
	{
        command += clickcmdid;
    }
    
	if (value=="delete") 
	{
		if(!confirm("{TXT_CONFIRM_DELETE}")) 
		{
			menuBlocked = true;
			setTimeout("nextMenuClick()",500);
			return;
		}
		menuBlocked = true;
		setTimeout("nextMenuClick()",500);
	}
	
	//alert(target+" - "+command+" - "+value+" - "+cmd);
	
    html = "<form name=cmform id=cmform method=post action='"+actionUrl+"'>";
    html += "<input type=hidden name='target[]' value='"+target+"'>";
    html += "<input type=hidden name='"+command+"' value='"+value+"'>";
    html += "<input type=hidden name='"+cmd+"' value='Ok'>";
    html += "</form>";

    dd.elements.actionForm.write(html);
    //alert(html);
    obj = document.getElementById("cmform");
    obj.submit();
    
}

function M_in(cell) 
{
    cell.style.cursor='pointer';
    cell.bgColor='gray';
    doCloseContextMenuCounter=-1;
}
function M_out(cell) 
{
    cell.bgColor='';
    doCloseContextMenuCounter=5;
}

var oldMposx = -1;
var oldMposy = -1;    
function followmouse1(e) 
{

    if (!e) var e = window.event;
    
    if (e.pageX || e.pageY)
	{
		Mposx = e.pageX;
		Mposy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		Mposx = e.clientX + document.body.scrollLeft;
		Mposy = e.clientY + document.body.scrollTop;
	}
    
    if (mouseIsDown) 
	{
        
        if ( Math.sqrt((Mposx-oldMposx)*(Mposx-oldMposx) + (Mposy-oldMposy)*(Mposy-oldMposy)) > 4 ) 
		{
            beginDrag();
        }
        
    }
    
    moveDragDropSymbol();
    
}

function doKeyDown(e) 
{
    if (!e) var e = window.event;
    kc = e.keyCode;
    kc = kc*1;
    if(kc==17) 
	{
        dd.elements.contextmenu.hide();
        oldMposx = Mposx;
        oldMposy = Mposy;
        mouseIsDown = true;        
    }
}

function doKeyUp(e) 
{
    if (!e) var e = window.event;
    kc = e.keyCode;

    kc = kc*1;
    if(kc==17) 
	{
        mouseIsDown = false;
        dd.elements.dragdropsymbol.hide();
        dd.elements.dragdropsymbol.moveTo(-1000,-1000);
        setTimeout("dragDropShow = false",500);
    }
}

document.onmousemove=followmouse1;
//document.onkeydown=doKeyDown;
//document.onkeyup=doKeyUp;


</script>

<script src="{JS_DRAGDROP}" language="JavaScript" type="text/javascript"></script>

<!-- content of this layer will be changed to create a form to submit the action of the selected menuitem -->
<div id="actionForm"></div>

<div id="dragdropsymbol" style="position:absolute;left:-1000;top:-1000;visibility;hidden;"><img src="{IMG_DRAGDROP}"></div>


<div xmlns:xhtml="http://www.w3.org/1999/xhtml" style="position:absolute;left:-1000;top:-1000;visibility:hidden;" id="movebeforeaftermenu">  
<table border="1" cellspacing="0" cellpadding="0" bgcolor="white">    
<tr>      
<td>        
	<table cellspacing="0" cellpadding="2" border="0">          
	<tr>            
		<td onMouseOver="M_in(this);" onMouseOut="M_out(this);" onClick="callBeforeAfterAction('moveBefore');">{TXT_INSERT_BEFORE}</td>
	</tr>
	<tr>
		<td onMouseOver="M_in(this);" onMouseOut="M_out(this);" onClick="callBeforeAfterAction('moveAfter');">{TXT_INSERT_AFTER}</td>          
	</tr>
	<tr>
		<td onMouseOver="M_in(this);" onMouseOut="M_out(this);" onClick="doCloseContextMenuCounter=2;">{TXT_INSERT_CANCEL}</td>          
	</tr>
	</table>
</td>
</tr>
</table>
</div>


<script>
var actionUrl = "{FORMACTION}";

//alert(names);
</script>

<script language="JavaScript" type="text/javascript">

    SET_DHTML("actionForm","dragdropsymbol","movebeforeaftermenu");

	<!-- BEGIN add_dhtml -->
		ADD_DHTML("{CONTEXTMENU}");
		dd.elements.{CONTEXTMENU}.setDraggable(false); 
	<!-- END add_dhtml -->
	
	dd.elements.dragdropsymbol.moveTo(-1000,-1000);
	
</script>


