/* JavaScript (c) Jakub Mahdal 2002 */

/* Mouse */
var mouseX = 0;
var mouseY = 0;
document.onmousemove = mouseMove;
function mouseMove(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	mouseX = posx;
	mouseY = posy;
}

var favoriteAdded = false; // je stranka pridana k oblibenym?


/* ----------------- definice metod --------------------------- */	

//pridat k oblibenym - pod jmenem jako je v titulku stranky
function addToFavorite(linkObj,addUrl,addTitle) { 
	if (document.all && !window.opera) { 
		window.external.AddFavorite(addUrl,addTitle); 
		return false; 
	} else if (window.opera && window.print) { 
		linkObj.title = addTitle; 
		return true; 
	} else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')) { 
		if (window.confirm('Přidat oblibenou stránku mezi záložky?')) { 
			window.sidebar.addPanel(addTitle,addUrl,''); 
			return false; 
		} 
	}
	return false; 
}

function clearValue(elem, txt) {    
	if (elem.value.indexOf(txt, 0) == 0) elem.value = '';
}

function hideElement(e)
{
	elem = document.getElementById(e);
	if ( null != elem )
		elem.style.display='none';
}
function showElement(e)
{
	elem = document.getElementById(e);
	if ( null != elem )
		elem.style.display='block';
}

/* hint */
function showHint( hint )
{
	var hintElement = document.createElement('div');
	hintElement.innerHTML = hint;
	var container = document.getElementById('jsInfoWindow');
	if ( container.hasChildNodes() )
		container.replaceChild(hintElement,container.childNodes[0]);
	else
		container.appendChild(hintElement);
	container.style.left = (mouseX+10) + 'px';
	container.style.top = (mouseY+10) + 'px';
	showElement('jsInfoWindow');
	/* upravime umisteni hintu pokud je moc vpravo */
	if ((0 + mouseX + container.offsetWidth) > (0 + document.documentElement.clientWidth))
		container.style.left = Math.max(0, ((document.documentElement.clientWidth) - container.offsetWidth)) + 'px';
}
function hideHint()
{
	hideElement('jsInfoWindow');	
}

function showModHint( linkObject )
{
	parent_node = linkObject.parentNode || linkObject.parent;
	if (parent != null)
	{
		tablecell = parent_node.parentNode || parent_node.parent;
		if(tablecell != null)
		{
			paragraph = tablecell.getElementsByTagName('p')[0];
			if (paragraph != null)
				showHint(paragraph.innerHTML);
		}
	}
}

function hideModulesDescp(tableclass)
{
	tables = document.getElementsByTagName('table');
	for(i=0; i<tables.length;i++)
	{
		if(tables[i].className = tableclass)
		{
			parags = tables[i].getElementsByTagName('p');
			for(j=0; j<parags.length;j++)
			{
				parags[j].style.display='none';
			}		
		}
	}
}