current_visible = null;
globalTime = 7000;
function hideDiv() {
	if ( current_visible >= 0) {
		var current_name = "altDiv" + current_visible;
		var div = document.getElementById( current_name);
		if ( div) {
			div.style.display = "none";
		}
	}
}
function closeDiv() {
	var timeOut = window.setTimeout( "hideDiv()", 350);
}
function showDiv( id, event) {
	hideDiv();
	var current_name = "altDiv" + id;
	var div = document.getElementById( current_name);
	
	if ( div && div.style.display == "none") {
		current_visible = id;
		div.style.display = "block";
	}
	var wwidth = (window.innerWidth)?window.innerWidth: ((document.all)?document.body.offsetWidth:null);
	if (!event) event=window.event;
	x = (event.clientX) ?  event.clientX : ((event.pageX) ? event.pageX : event.screenX);
	y = (event.clientY) ? (event.clientY + 15) : (event.pageY + 15);
	if ( document.documentElement.scrollTop == 0) {
		y += document.body.scrollTop;
	} else {
		y += document.documentElement.scrollTop;
	}
	
	if ( x + 300 >= wwidth) {
		x -= 280;
	}
	div.style.top = y+"px";
	div.style.left = x+"px";
}
function activateMotion( direction) {
	clearTimeout( globalTimeOut);
	globalTime = 15000;
	beginMotion( direction);
	globalTimeOut = window.setTimeout( function(){ autoMotion( direction)}, globalTime);
}
function autoMotion( direction) {
	globalTime = 10000;
	beginMotion( direction);
	globalTimeOut = window.setTimeout( function(){ autoMotion( direction)}, globalTime);
}
function beginMotion( direction) {
	for ( var i = 0; i < bigPic.img_array.length; i ++) {
    	current_id = "nadpis_" + bigPic.img_array[i].id;
		document.getElementById( current_id).style.visibility = "hidden";
	}
    bigPic.changeMulti( direction);
    rightPic.changeMulti( direction);
    leftPic.changeMulti( direction);
}

