// JavaScript Document


function jumpToEditMode() {
	document.location.href="index.php?login=start&menuid="+menuid;
}

function getkey(keyStroke) {
	eventChooser = event.keyCode;
	if (eventChooser==20) jumpToEditMode();
}
var	sessionImage=new Image();
function tickInit() {
	if (document.getElementById('topmenu')) {
		document.getElementById('topmenu').onmousedown=custom_selectmouse;
		document.getElementById('topmenu').onmouseup=function() {
			isdrag=false;
			if (custom_dobj) {
				if (custom_dobj.className=="boxontop") custom_dobj.style.filter="alpha(opacity=100) Shadow(Color=#999999, Direction=135)";
				else custom_dobj.style.filter="alpha(opacity=100)";
			}
			if (document.getElementById('dragImg') && custom_dobj) {
				sessionImage.src="site/sess.php?id="+custom_dobj.id+"&l="+parseInt(custom_dobj.offsetLeft)+"&t="+parseInt(custom_dobj.offsetTop);
			}
		}
	}
	if (editmode=="") {	
		document.onkeypress=getkey;
	}
}

var ie=document.all;
var nn6=document.getElementById&&!document.all;

var isdrag=false;
var custom_x,custom_y;
var custom_dobj;
var custom_noZone=false;
function custom_movemouse(e)
{

  if (isdrag)
  {
    custom_dobj.style.left = (nn6 ? custom_tx + e.clientX - custom_x : custom_tx + event.clientX - custom_x) + "px";
    custom_dobj.style.top  = (nn6 ? custom_ty + e.clientY - custom_y : custom_ty + event.clientY - custom_y) + "px";
    return false;
  }
}

function custom_selectmouse(e) 
{
  var custom_fobj       = nn6 ? e.target : event.srcElement;
  var custom_topelement = "HTML";
  while (custom_fobj.tagName != custom_topelement && custom_fobj.className != "box" && custom_fobj.className != "boxontop")
  {
    custom_fobj = nn6 ? custom_fobj.parentNode : custom_fobj.parentElement;
  }
  if ((custom_fobj.className=="box" || custom_fobj.className=="boxontop")&&!custom_noZone)
  {
    isdrag = true;
	if (custom_dobj) custom_dobj.style.zIndex=2;
    custom_dobj = custom_fobj;
    custom_dobj.style.filter="alpha(opacity=50) Shadow(Color=#999999, Direction=135)";
	custom_dobj.style.zIndex=3;
	custom_tx = parseInt(custom_dobj.offsetLeft+0);
    custom_ty = parseInt(custom_dobj.offsetTop+0);
    custom_x = nn6 ? e.clientX : event.clientX;
    custom_y = nn6 ? e.clientY : event.clientY;
    document.onmousemove=custom_movemouse;
    return false;
  }
}


