

	var highZ = 3;



// Demo 1

function d1Setup()
{
  var d1 = xGetElementById("theLayer");
  xMoveTo(d1, 400, 400);
  xEnableDrag(d1, d1OnDragStart, d1OnDrag, d1OnDragEnd);
  xShow(d1);

}
function d1OnDragStart(ele, mx, my)
{
  window.status = '';
  xZIndex(ele, highZ++);
  ele.totalMX = 0;
  ele.totalMY = 0;
}
function d1OnDrag(ele, mdx, mdy)
{
  xMoveTo(ele, xLeft(ele) + mdx, xTop(ele) + mdy);
  ele.totalMX += mdx;
  ele.totalMY += mdy;
}
function d1OnDragEnd(ele, mx, my)
{
  window.status =
    ele.id +
    ':  Thanks for the drag!  Total X movement: ' + ele.totalMX +
    ',  Total Y movement: ' + ele.totalMY;
}


//list

	function ddlSortingByChange(e)
	{
			if (window.navigator.appName.toLowerCase().indexOf("microsoft") < -1) 
			{
				__doPostBack('<%=ddlSortingBy.UniqueID.Replace(":","$")%>','');
			}
			else
			{
				__doPostBack('<%=ddlSortingBy.UniqueID%>','');
			}
			return true;
	}
	function ddlAscendingChange(e)
	{
			if (window.navigator.appName.toLowerCase().indexOf("microsoft") < -1) 
			{
				__doPostBack('<%=ddlAscending.UniqueID.Replace(":","$")%>','');
			}
			else
			{
				__doPostBack('<%=ddlAscending.UniqueID%>','');
			}
			return true;
	}
	function ddlItemsPerPageChange(e)
	{
			if (window.navigator.appName.toLowerCase().indexOf("microsoft") < -1) 
			{
				__doPostBack('<%=ddlItemsPerPage.UniqueID.Replace(":","$")%>','');
			}
			else
			{
				__doPostBack('<%=ddlItemsPerPage.UniqueID%>','');
			}
			return true;
	}


//search

	function textKeyEnter(e)
	{
			if (!e) var e = window.event; 

			if(e.keyCode == 13) 
			{
				if (window.navigator.appName.toLowerCase().indexOf("microsoft") < -1) 
				{
					__doPostBack('<%=bttSearch.UniqueID.Replace(":","$")%>','');
				}
				else
				{
					__doPostBack('<%=bttSearch.UniqueID%>','')
				}
			
			}
			return true;
	}

//word manager

//document.onselectstart=new Function ('return false');
function confirmSubmit()
{
	var a = document.getElementById("ahoj").offsetWidth
	var agree=confirm("Opravdu smazat?");
	if (agree)
		return true ;
	else
		return false ;
}


//form manager

//document.onselectstart=new Function ('return false');

//xfiles

//document.onselectstart=new Function ('return false');

//cotpl40viewer


function replace(){
	var strText = new String() ;
	strText = document.formLars._ctl1__ctl1_txtMessage.value;
	var re = new RegExp ('<') ;
	do{
		strText=strText.replace(re,'&lt;');
	}
	while(strText.indexOf('<',0)>=0);
	re = new RegExp ('>') ;
	do{
		strText=strText.replace(re,'&gt;');
	}
	while(strText.indexOf('>',0)>=0);
	document.formLars._ctl1__ctl1_txtMessage.value=strText;
}


//cotpl6viewer

function addFavourite(href,descr){
	location='<%=viewer.FileName%>?cmd=addFavourite&amp;href='+href+'&amp;descr='+descr+'&amp;backurl=<%=viewer.CurrentPageInfo.Href%>';
}

//navigator

function navigator1 ()
{
	var so1 = new SWFObject("/flash/vyber_dum5.swf", "animace-flash", "385","300" ,"7","#F2F3F5");
	so1.addParam("wmode", "transparent");
	so1.write("navigator");
}

var prem1='boxWrapper1';
var prem2='boxWrapper2';

function eval_wrapers ()
{
var pc=0;
var le=0;
var del=0;
var rem=0;
/*wraper1*/
var elm=document.getElementById (prem1);
var spans = elm.getElementsByTagName("li"); //array of lis max length=36 max height 14
for (var i=0; i<spans.length; i++)
	{
	 if (spans [i].innerHTML.length>36)
		{
		 le=spans [i].innerHTML.length;
		 del=le/36;
		 del=Math.ceil (del);
		 	pc=pc+del;
		}
	 else
	 pc++;
//		document.write ('\n'+pc);	
		//document.write (spans [i].innerHTML+spans [i].innerHTML.length);
		if (pc>14)
		{
		 document.getElementById ('wrap1up').className='trioButtTopActive';
 		 document.getElementById ('wrap1down').className='trioButtBottomActive ';
		 break;
			
		}
	del=rem=le=0;
	}
if (pc<=14)
	{
		 document.getElementById ('wrap1up').className='trioButtTopNo';
 		 document.getElementById ('wrap1down').className='trioButtBottomNo  ';		
		 


	}
else
	{
		document.getElementById ('wrap1up').className='trioButtTopActive';
 		document.getElementById ('wrap1down').className='trioButtBottomActive ';
	}
//document.write (pc);


/*wraper2*/
pc=le=del=rem=0;
elm=document.getElementById (prem2);
spans = elm.getElementsByTagName("li");
for (var i=0; i<spans.length; i++)
	{
	 if (spans [i].innerHTML.length>36)
		{
		 le=spans [i].innerHTML.length;
		 del=le/36;
		 del=Math.ceil (del);
		 	pc=pc+del;
		}
	 else
	 pc++;
//		document.write ('\n'+pc);	
		//document.write (spans [i].innerHTML+spans [i].innerHTML.length);
		if (pc>10)
		{
		 document.getElementById ('wrap2up').className=' trioButtTopActive';
		 document.getElementById ('wrap2down').className='trioButtBottomActive  ';		
		 document.getElementById ('chargebut').style.position='relative';
		 break;
			
		}
	del=rem=le=0;
	}
if (pc<=10)
	{
		 document.getElementById ('wrap2up').className=' trioButtTopNo';
 		 document.getElementById ('wrap2down').className=' trioButtBottomNo  ';
		 document.getElementById ('chargebut').style.position='absolute';
	}
else
	{
		 document.getElementById ('wrap2up').className=' trioButtTopActive';
 		 document.getElementById ('wrap2down').className=' trioButtBottomActive ';		

		 document.getElementById ('chargebut').style.position='relative';
	}
}



