var MouseXPosition = 0;
var MouseYPosition = 0;
	
function changeStatus(obj)
{
	var lngParentID, strEnvelopeID, s_img_id, s_last_url
	
	lngParentID=obj.id
	strEnvelopeID="_" + lngParentID

	//zmena stavu zobrazeni podvetve
	if(document.all[strEnvelopeID].className=="visible")
		document.all[strEnvelopeID].className="invisible"
	else 
		document.all[strEnvelopeID].className="visible"

	//id rozbalovaciho/sbalovaciho obrazku
	s_img_id='i' + lngParentID
	if(document.all.item(s_img_id)==null)
		return;
	if(typeof(document.all.item(s_img_id))=="object")
	{
		//vymena rozbalovaciho/sbalovaciho obrazku
		s_last_url=document.all.item(s_img_id).src
		s_last_url_length=s_last_url.length
		s_last_img=s_last_url.substring(s_last_url_length-5,s_last_url_length)
		
		if(s_last_img=="+.gif")
			document.all.item(s_img_id).src="/images/Tree/-.gif"
		else 
			document.all.item(s_img_id).src="/images/Tree/+.gif"			
	}
}

	function SelectNew(pTop)
	{
		var obj=GetElement('K');
		if(obj==null)
			return;
		var len=GetElement('K').length;
				
		for(i=0;i<len;++i)
		{
			if(Number(obj[i].name)>pTop)
			{
				obj[i].innerHTML='<font color=#ff0033>*</font>';
			}
		}
	}
	
	function SetTop(pTop, pArtID)
	{
		SetCookie('ArtId'+pArtID, pTop)
	}
	
	function GetTop(pArtID)
	{
		var TopId=GetCookie('ArtId'+pArtID);
		if(TopId==0)
			return 0;		
		return TopId;
	}



function popUp(menuName,on)
{
	menuName = menuName.toString()

	if (on)
		{	
			//moveLayers();
			document.getElementById(menuName).style.display = "block";
			document.getElementById("form-name").focus();
		}
		else
		{
			document.getElementById(menuName).style.display = "none";	
		}
}

function moveLayers() 
{
	document.getElementById('sendArticle').style.left = MouseXPosition-140;
	document.getElementById('sendArticle').style.top = MouseYPosition+10;
}

function GetElement(o)
{
	if (document.all)  
		return document.all[o];
	else
	{
		var obj=document.getElementById(o);
		if (obj==null)
		{
			var objs=document.getElementsByName(o);
			if (objs.length>0)
				obj=objs[0];
		}
		
		return obj;
	}
}
	
function DoColor(obj)
{
	var AutorTD=document.getElementById('A' + obj)
	var TitleTD=document.getElementById('T' + obj)
	
	if(TitleTD.style.backgroundColor=='')
	{
		AutorTD.style.backgroundColor='DarkGray';
		TitleTD.style.backgroundColor='DarkGray';
	}
	else
	{
		AutorTD.style.backgroundColor='';
		TitleTD.style.backgroundColor='';
	}

}

function GetSelectedNodes()
{
	var len=GetElement("forum").rows.length;
	var temp='';
	var id;
	for(i=0;len>i;++i)
	{
		if(GetElement("forum").rows[i].cells[0].style.backgroundColor!='')
		{
			id=GetElement("forum").rows[i].cells[0].id;
			temp+=(id).substring(1,id.length) + ',';
		}
	}
	return temp.substring(0,temp.length-1);
}

function SetForm(pPostUrl,pClearState)
{
	if(pClearState)
		ResetState();

	document.forms[0].action=pPostUrl;
	document.forms[0].submit();	
}

function ResetState()
{
	window.document.design.__VIEWSTATE.value=''
	window.document.design.__VIEWSTATE.name='hide';
}
