var submenu = false;
var activemenu = false;
var menutoclose = false;
var timer = false;
var actionmenu = false;
  	
function showMenu(parent, target) {
	if ( document.getElementById('menu-'+target) ) {
		var x = findPosLeft(parent);
		var y = findPosTop(parent);

		if ( ( navigator.userAgent.toLowerCase().indexOf( 'msie 6' ) != -1 ) || ( navigator.userAgent.toLowerCase().indexOf( 'msie 7' ) != -1 ) ) {
				document.getElementById('menu-'+target).style.top = y + parent.offsetTop + 23 + 'px';
		} else {
			document.getElementById('menu-'+target).style.top = y + parent.offsetTop - 80 + 'px';
		}
		document.getElementById('menu-'+target).style.left = x +  'px';
		document.getElementById('menu-'+target).style.display= 'block';
		activemenu = document.getElementById('menu-'+target);
	}
}
  
function closeMenu() {
	if ( activemenu )
 		activemenu.style.display = 'none';
}
  	
function hideMenu() {
	closeMenu();
}
  
function findPosTop(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		do {
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		return curtop;
	}
}
  	
function findPosLeft(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
		} while (obj = obj.offsetParent);
		return curleft;
	}
}
  	
function showSubmenu(target) {
	menutoclose = false;
	document.getElementById('menu-'+target).style.display = 'block';
}

function showAction( action ) {
	if ( !action ) {
		action = 1;
	}
	actions = new Array();
	actions[0] = '';
	actions[1] = '<a href="/cs/official-promo-tour-bushman-subaru-2010-307.html"><img src="/t/b/i/holiday-2010-hp.jpg" /></a>';
	actions[2] = '<a href="/cs/bushman-expedition-2010.html"><img src="/t/b/i/top-akce-expedice-peru.jpg" /></a>';
//	actions[3] = '<img src="/t/b/i/top-akce2.jpg" />';
	
	
	if ( actionmenu ) {
		actionmenu.style.display = 'none';
		document.getElementById('akce20').innerHTML = '<a href="#" onclick="showAction();">OTEVŘÍT BANNER</a><br /><img src="/t/b/i/t-m-akce.gif" alt="" />';
		actionmenu = false;
	} else {
		parent2 = document.getElementById('akce20');
		var x = findPosLeft(parent2);
		var y = findPosTop(parent2);
		var noPx = document.childNodes ? 'px' : 0;
		
		actionmenu = document.getElementById('menu-20');
		actionmenu.style.left = x + noPx; // + 'px';
		
		if ( ( navigator.userAgent.toLowerCase().indexOf( 'msie 6' ) != -1 ) || ( navigator.userAgent.toLowerCase().indexOf( 'msie 7' ) != -1 ) ) {
			actionmenu.style.top = y + 37 + parent2.offsetTop + noPx; //+ 'px';
		} else {
			actionmenu.style.top = y - 64 + parent2.offsetTop + noPx; //+ 'px';
		}
		actionmenu.style.display = 'block';
		actionmenu.innerHTML = actions[action];
		parent2.innerHTML = '<a href="#" onclick="showAction();">ZAVŘÍT BANNER</a><br /><img src="/t/b/i/t-m-akce.gif" alt="" />';
	}
}
//if ( 'menu-'+target == 'menu-20' ) {
//	if ( actionmenu ) {
//		closeMenu();
//		return;
//	} else {
//		actionmenu = document.getElementById('menu-'+target);
//		actionmenu.style.left = x - 57 + 'px';
//		actionmenu.style.top = y - 67 + parent.offsetTop + 'px';
//	}
//} else {
