/* mouse move :*/
var IE = document.all?true:false;

var tempX = 0;
var tempY = 0;

if (!IE) document.captureEvents(Event.MOUSEMOVE);

document.onmousemove = getMouseXY;

function hideHoldingEditOptions(itemID) {
	document.getElementById(itemID).style.display = "none";
	document.getElementById(itemID).style.position = "relative";
}

function getMouseXY(e) {
	if (IE) {
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	} else {
		tempX = e.pageX;
		tempY = e.pageY;
	}  

	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}
}



var scrolltimer;
var speed = 10;
var active = "";
window.onload = function() {
 obj=document.getElementById('mover1_cont');
 obj2=document.getElementById('mover2_cont'); 
 
}

function vertScroll(id, dir) {
 obj = eval("document.getElementById(id)");
 cont = eval("document.getElementById(id+'_cont')");
 if (dir == 'up') {
	moveUp(obj, cont);
 }
 if (dir == 'dw') {
   moveDwn(obj, cont); 
 }
}

function hideAll(id) {
 
}

function moveUp(obj, cont) {
	top_bound = parseInt(cont.style.top) + parseInt(cont.offsetHeight);
	y_pos = parseInt(obj.style.top);
	bottom = parseInt(obj.style.top) + parseInt(obj.offsetHeight)+ parseInt(cont.offsetHeight);

	if (obj && cont) {
		if (top_bound < bottom) {
		obj.style.top = y_pos - parseInt(speed);
		scrolltimer = setTimeout("moveUp(obj, cont)", 80);
		} 
	
		
	}
	
}

function moveDwn(obj, cont) {
	y_pos = parseInt(obj.style.top);
	if (obj && cont) {

		if (y_pos + parseInt(cont.style.top)-10 < parseInt(cont.style.top)) {
		obj.style.top = y_pos + parseInt(speed);
		scrolltimer = setTimeout("moveDwn(obj, cont)", 80);
		//alert("y_pos:"+y_pos+"; cont:"+cont.style.top)
		}
		//if (y_pos = parseInt(cont.style.top)) {stopScroll();}
		
	}	
}

function stopScroll() {
	clearTimeout(scrolltimer);
}
var id = "";
function startTimeOut(id) {
	alert(id)
	
	timerset = setTimeout("hideLayer()", 3000);
	
}

function hideLayer(id){
	
	obj = document.getElementById(id);
	if (obj) {
		obj.style.display="none";
		active = "";
	}
}

function getMouse(e,obj)
{
	
   if (document.getElementById(active+'_cont')) {
    document.getElementById(active+'_cont').style.display = 'none';
   
   }	
//tempX se vzima ot http://911.bg/ispider/wms/Inc.js 
  if (document.getElementById(obj + '_cont')){
	divCenter = document.getElementById(obj + '_cont').offsetWidth / 2;
	document.getElementById(obj + '_cont').style.display = 'block';
	document.getElementById(obj + '_cont').style.left = tempX - divCenter;
	active = obj;
  }
}

