function open_window(url,w,h) 
{
  var twidth = w;
  var theight = h;

  if(twidth > screen.width - 40) twidth = screen.width - 40;
  if(theight > screen.height - 40) theight = screen.height - 40;

  var pos_x = (screen.width - twidth - 10)/2;
  var pos_y = (screen.height - theight - 29)/2;
   
  if(typeof(c1window) == "undefined" || c1window.closed)  
    c1window = window.open(url,'c1window','menubar=0,toolbar=0,location=0,scrollbars=1,screenX='+pos_x+',screenY='+pos_y+',left='+pos_x+',top='+pos_y+',width='+twidth+',height='+theight+',resizable=1');  
  else c1window.location.href = url;
  
	c1window.focus();
}

function open_window_ns(url,w,h) 
{
  var twidth = w;
  var theight = h;

  if(twidth > screen.width - 40) twidth = screen.width - 40;
  if(theight > screen.height - 40) theight = screen.height - 40;

  var pos_x = (screen.width - twidth - 10)/2;
  var pos_y = (screen.height - theight - 29)/2;
   
  if(typeof(c1window) == "undefined" || c1window.closed)  
    c1window = window.open(url,'c1window','menubar=0,toolbar=0,location=0,scrollbars=0,screenX='+pos_x+',screenY='+pos_y+',left='+pos_x+',top='+pos_y+',width='+twidth+',height='+theight+',resizable=1');  
  else c1window.location.href = url;
  
	c1window.focus();
}

function open_window_ek(url,w,h) 
{
  var twidth = w;
  var theight = h;

  if(twidth > screen.width - 40) twidth = screen.width - 40;
  if(theight > screen.height - 40) theight = screen.height - 40;

  var pos_x = (screen.width - twidth - 10)/2;
  var pos_y = (screen.height - theight - 29)/2;
   
  if(typeof(c1window) == "undefined" || c1window.closed)  
    c1window = window.open(url,'c1window','menubar=0,toolbar=0,location=0,scrollbars=0,screenX='+pos_x+',screenY='+pos_y+',left='+pos_x+',top='+pos_y+',width='+twidth+',height='+theight+',resizable=0');  
  else c1window.location.href = url;
  
	c1window.focus();
}

function UkazSkrySMS ()
{
	var obj = document.getElementById ( "item24" );

	if ( obj == null ) return;

	var sms1 = document.getElementById ( "item42" );
	var sms2 = document.getElementById ( "label42" );
	
	if ( sms1 == null || sms2 == null ) return;
	
	if ( obj.checked )
	{
		var em = document.getElementById ( "item41" );
		em.click ();
	}
	
	sms1.style.display = obj.checked ? 'none' : 'inline';
	sms2.style.display = obj.checked ? 'none' : 'inline';
	
	
}

max_chars = 900;

function cl ( elem )
{
	var name = elem.name;
	var max = max_chars;
	
	var obj = document.getElementById ( name );
	var strlen = obj.value.length;
	
	if ( strlen > max )
	{
		obj.value = obj.value.substring ( 0, max );
		chars_left = 0;
	}else chars_left = max - strlen;
	
	var obj2 = document.getElementById ( name + '_celkom' );

	obj2.innerHTML = chars_left;
}

function UkazPanel(elem)
{
	var ul = elem.parentNode.parentNode;
	var ul_li = ul.getElementsByTagName("li");
	var div = ul.parentNode.nextSibling;

	for (var i=0; i<ul_li.length; i++) {
		if (ul_li[i].firstChild == elem) {
			ul_li[i].className = "sel";
			div.childNodes[i].style.display = "";
		} else {
			ul_li[i].className = "";
			div.childNodes[i].style.display = "none";
		}
	}

	return false;
}

function UkazPolozky(elem)
{
	elem.nextSibling.style.display = elem.nextSibling.style.display == "none" ? "" : "none";

	return false;
}

function Group1(what)
{
	document.getElementById("group1_text").style.display = what ? "" : "none";
}
