function getElementsByClassName(className,parentElement) {
    var elements = [];
    var parentElement = parentElement || document.getElementsByTagName("html")[0];
    var nodes = parentElement.getElementsByTagName('*');

    for (var i = 0, child; child = nodes[i]; i++) {
      if (child.className && hasClassName(child,className)) {
        elements.push(child);
      }
    }
  return elements;
}

function hasClassName(element,className) {
    return element.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)"));
}



function showImage(url,w,h){



	wasOpen  = false;

  if ( (0<w) && (0<h) )

  {

	  win = window.open('', '', 'left='+(screen.width/2-100)+', top='+(screen.height/2-80)+', width=190, height=180, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');

	}

	else

	{

    win = window.open(url);

  }



  win.focus();



  win.document.write('<html style="padding: 0; maring: 0;"><body style="padding: 0; maring: 0;"><div style="text-align: center;" id="loading"><img src="images/loading.gif" width="168" height="147" alt="" /></div><img id="photo" style="position: absolute; left: 0; top: 0; visibility: hidden;" onclick="window.close();" onload="this.style.visibility=\'visible\'; window.moveTo(screen.width/2-(document.images.photo.width+30)/2, screen.height/2-(document.images.photo.height+60)/2); window.resizeTo((document.getElementById(\'photo\').offsetWidth), (document.getElementById(\'photo\').offsetHeight+65)); window.moveTo(screen.width/2-(document.images.photo.width+10)/2, screen.height/2-(document.images.photo.height+60)/2);" name="photo" src="'+url+'" alt="" /></body></html>');



  

  return (typeof(win)=='object')?true:false;





} 
function showDetail(url,w,h){

	wasOpen  = false;
  if ( (0<w) && (0<h) )
  {
	 win = window.open(url,'detail','left='+(screen.width/2-w/2)+', top='+(screen.height/2-h/2)+', width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	}
	else
	{
    win = window.open(url);
  }
	win.focus();
  return (typeof(win)=='object')?true:false;

}       


function showSubmenu(no)
{
  if (document.getElementById('submenu'+no))
  {
    document.getElementById('menu'+no).style.background='url(../images/menu-active.png) right bottom no-repeat'; 
    document.getElementById('submenu'+no).style.visibility='visible';  
    document.getElementById('submenu'+no).style.top=(document.getElementById('menu'+no).offsetTop+2)+'px';  
  }
}

function hideSubmenu(no)
{       
  if (document.getElementById('submenu'+no))
  {
    document.getElementById('menu'+no).style.background='url(../images/menu-separator.jpg) right bottom no-repeat'; 
    document.getElementById('submenu'+no).style.visibility='hidden';  
  }
}










  function monthName(month){

   
    var mn=new Array(13); 
    
    mn[1]='Leden';
    mn[2]='Únor';
    mn[3]='Březen';
    mn[4]='Duben';
    mn[5]='Květen';
    mn[6]='Červen';
    mn[7]='Červenec';
    mn[8]='Srpen';
    mn[9]='Září';
    mn[10]='Říjen';
    mn[11]='Listopad'; 
    mn[12]='Prosinec';
    
    return mn[month];
  }


// nastavi datum a cas vybrany v kalendari do inputboxu "date"

function setDateTime(day, month, year, hour, min, obj)
{
  document.getElementById('time_select').style.visibility='hidden';
  document.getElementById(obj).value=day+'. '+month+'. '+year+', '+document.getElementById('hour').value+':'+document.getElementById('minute').value;
}            




// zobrazi kalendar

function calendar(month, year, hour, min, obj)
{
  var content;
  
  
  if ('visible'!=document.getElementById('time_select').style.visibility)   
  {  
    var string=new String(document.getElementById(obj).value);
    var tmp=string.split(', ');
    var tmp_date=new String(tmp[0]);
    var tmp_time=new String(tmp[1]);
    
    var date=tmp_date.split('. ');
    var time=tmp_time.split(':');
    

    n_month=date[1];
    n_year=date[2];
    
    n_hour=time[0];
    n_min=time[1]; 
    
    
    if ( 
      (parseInt(n_month)<13) && (parseInt(n_month)>0)
      &&
      (parseInt(n_year)<3000) && (parseInt(n_year)>1970)
      &&
      (parseInt(n_hour)<25) && (parseInt(n_hour)>=0)
      &&
      (parseInt(n_min)<60) && (parseInt(n_min)>=0) 
    )
    {
      month=parseInt(n_month);   
      year=parseInt(n_year);
      hour=parseInt(n_hour);
      min=parseInt(n_min);
    }
    
  }
  
  date=new Date(year, month-1, 1);
  var dow=date.getDay()-1;
  
  
  var daysinmonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) daysinmonth[2] = 29;
  
  var nod=daysinmonth[month-1];
  
  
  content='<div class="float_right" onmouseover="this.style.cursor=\'pointer\';" onclick="document.getElementById(\'time_select\').style.visibility=\'hidden\';">X</div><b>Zvolte čas a poté datum</b> ';

  content+='<div class="margin-top"><input type="text" id="hour" maxlength="2" value="'+hour+'" /><input type="text" id="minute" maxlength="2" value='+min+' /></div><div class="clear_both"><!-- --></div>';

  content+='<div id="cal_tab"><table id="calendar_table" cellpadding="0" cellspacing="0" border="0">';

  content+='<tr><th>Po</th><th>Út</th><th>St</th><th>Čt</th><th>Pá</th><th>So</th><th>Ne</th></tr>';

  
  if (dow<0)
  {
    dow=dow+7;
  }
  
  for (i=1; i<=dow%7; i++)
  {
    if (1==i%7)
    {
      content+='</tr><tr>';
    }
    content+='<td>&nbsp;</td>'; 
  
  }
  
  
  for (i=dow+1; i<=nod+dow; i++)
  {
    if (1==i%7)
    {
      content+='</tr><tr>';
    }   
    
    content+='<td><span onmouseover="this.style.cursor=\'pointer\';" onclick="setDateTime('+(i-dow)+', '+month+', '+year+', '+hour+', '+min+', \''+obj+'\')">'+(i-dow)+'</a></td>';           
  }

  if (0!=(nod+dow)%7)
  {
    for (i=(nod+dow)%7; i<7; i++)
    {
      content+='<td>&nbsp;</td>'; 
    }
  }

  content+='</tr>';   
  
  content+='</table></div>';   
   
  if (month>1)
  {
    content+='<span onmouseover="this.style.cursor=\'pointer\';" onclick="calendar('+(month-1)+', '+year+', '+hour+', '+min+', \''+obj+'\')"> &lt; </span>';
  }
   
  content+=monthName(month);
  
  if (month<12)
  {
    content+='<span onmouseover="this.style.cursor=\'pointer\';" onclick="calendar('+(month+1)+', '+year+', '+hour+', '+min+', \''+obj+'\')"> &gt; </span>';
  }
 
  content+='<br />';
 
  if (year>1970)
  {
    content+='<span onmouseover="this.style.cursor=\'pointer\';" onclick="calendar('+month+', '+(year-1)+', '+hour+', '+min+', \''+obj+'\')"> &lt; </span>';
  }
    
  content+=year;
  
  if (year<3000) 
  {
    content+='<span onmouseover="this.style.cursor=\'pointer\';" onclick="calendar('+month+', '+(year+1)+', '+hour+', '+min+', \''+obj+'\')"> &gt; </span><br />';
  }

  
  

  document.getElementById('time_select').style.left=(screen.width/2-document.getElementById('time_select').offsetWidth/2)+'px';
  document.getElementById('time_select').style.top=(screen.height/2-document.getElementById('time_select').offsetHeight/2)+'px';
  document.getElementById('time_select').style.visibility='visible';
  document.getElementById('time_select').innerHTML=content;
}   














function setDate(day, month, year, obj)
{
  document.getElementById('time_select').style.visibility='hidden';
  document.getElementById(obj).value=day+'. '+month+'. '+year;

  if (document.getElementById('curtain'))
  { 
    document.getElementById('curtain').style.display='none';
  }

}            





function calendarDate(month, year, obj)
{
  if (document.getElementById('curtain'))
  { 
    document.getElementById('curtain').style.display='block';
  }


  var content;
  var css_class;

  if (month<1)
  {
    month=12;
    year--;
  }
  
  if (month>12)
  {
    month=1;
    year++;
  }
  
  if ('visible'!=document.getElementById('time_select').style.visibility)   
  {  
    var string=new String(document.getElementById(obj).value);
    var tmp=string.split(', ');
    var tmp_date=new String(tmp[0]);
    var tmp_time=new String(tmp[1]);
    
    var date=tmp_date.split('. ');
    var time=tmp_time.split(':');
    

    n_month=date[1];
    n_year=date[2];
    
    
    
    if ( 
      (parseInt(n_month)<13) && (parseInt(n_month)>0)
      &&
      (parseInt(n_year)<3000) && (parseInt(n_year)>1970)
    )
    {
      month=parseInt(n_month);   
      year=parseInt(n_year);
    }
    
  }
  
  date=new Date(year, month-1, 1);
  var dow=date.getDay()-1;

  var today=new Date();
  
  
  var daysinmonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) daysinmonth[2] = 29;
  
  var nod=daysinmonth[month-1];
  
  
  content='<div class="float_right" onmouseover="this.style.cursor=\'pointer\';" onclick="  if (document.getElementById(\'curtain\')) document.getElementById(\'curtain\').style.display=\'none\'; document.getElementById(\'time_select\').style.visibility=\'hidden\';">X</div><b>Zvolte datum</b> ';

  content+='<div id="cal_tab"><table id="calendar_table" cellpadding="0" cellspacing="0" border="0">';

  content+='<tr><th>Po</th><th>Út</th><th>St</th><th>Čt</th><th>Pá</th><th class="weekend">So</th><th class="weekend">Ne</th></tr>';

  
  if (dow<0)
  {
    dow=dow+7;
  }
  
  for (i=1; i<=dow%7; i++)
  {
    if (1==i%7)
    {
      content+='</tr><tr>';
    }
    content+='<td>&nbsp;</td>'; 
  
  }
  
  
  for (i=dow+1; i<=nod+dow; i++)
  {
    if (1==i%7)
    {
      content+='</tr><tr>';
    }   
      
      if ( ((i-dow)==today.getDate()) && (month==(today.getMonth()+1)) && (year==(today.getYear()+1900)) )
      {
        css_class=' class="today"';
      }
      else
      if ( (i%7>5) ||  (0==i%7) )
      {
        css_class=' class="weekend"';
      }
      else
      {
        css_class='';
      }
    
    content+='<td'+css_class+'><span onmouseover="this.style.cursor=\'pointer\';" onclick="setDate('+(i-dow)+', '+month+', '+year+', \''+obj+'\')">'+(i-dow)+'</a></td>';           
  }

  if (0!=(nod+dow)%7)
  {
    for (i=(nod+dow)%7; i<7; i++)
    {
      content+='<td'+css_class+'>&nbsp;</td>'; 
    }
  }

  content+='</tr>';   
  
  content+='</table></div>';   
  
  content+='<div id="month_year_select">';
  
  content+='<span class="left_arrow" style="padding-left: 15px;" onmouseover="this.style.cursor=\'pointer\';" onclick="calendarDate('+(month-1)+', '+year+', \''+obj+'\')"><!-- --></span>';
   
  content+='<span class="month_select">'+monthName(month)+'</span>';
  
  content+='<span class="right_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendarDate('+(month+1)+', '+year+', \''+obj+'\')"><!-- --></span>';
 
  content+='<div class="clear_both"><!-- --></div>';
 
  if (year>10)
  { 
    content+='<span class="left_long_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendarDate('+month+', '+(year-10)+', \''+obj+'\')"><!-- --></span>';
  }

  if (year>1)
  {
    content+='<span class="left_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendarDate('+month+', '+(year-1)+', \''+obj+'\')"><!-- --></span>';
  }
    

  content+='<span class="year_select">'+year+'</span>';
  
  if (year<4091) 
  {
    content+='<span class="right_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendarDate('+month+', '+(year+1)+', \''+obj+'\')"><!-- --></span>';
  }

  if (year<5000) 
  {
    content+='<span class="right_long_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendarDate('+month+', '+(year+10)+', \''+obj+'\')"><!-- --></span>';
  }
  content+='<div class="clear_both"><!-- --></div>';
  
  content+='</div>';
   
  document.getElementById('time_select').style.left=(screen.width/2-document.getElementById('time_select').offsetWidth/2)+'px';
  document.getElementById('time_select').style.top=(screen.height/2-document.getElementById('time_select').offsetHeight/2)-100+'px';
  document.getElementById('time_select').style.visibility='visible';
  document.getElementById('time_select').innerHTML=content;
}   




























function setDate2(day, month, year, obj)
{
  document.getElementById('time_select').style.visibility='hidden';
  document.getElementById(obj).value=day+'. '+month+'. '+year;
  if ('prijezd'==obj)
  {
    day+=document.getElementById('days').value*1-1;
    var d=new Date(year, month, day, 12, 0, 0, 0);
    document.getElementById('odjezd').value=(d.getDate()+'. '+d.getMonth()+'. '+d.getFullYear());
  }
  
}            





function calendar2(month, year, object)
{

  

  var obj=object.id;
  var content;
  var css_class;

  if (month<1)
  {
    month=12;
    year--;
  }
  
  if (month>12)
  {
    month=1;
    year++;
  }
  
  if ('visible'!=document.getElementById('time_select').style.visibility)   
  {
  
    
    var string=new String(document.getElementById(obj).value);
    var tmp=string.split(', ');
    var tmp_date=new String(tmp[0]);
    var tmp_time=new String(tmp[1]);
    
    var date=tmp_date.split('. ');
    var time=tmp_time.split(':');
    

    n_month=date[1];
    n_year=date[2];
    
    
    
    if ( 
      (parseInt(n_month)<13) && (parseInt(n_month)>0)
      &&
      (parseInt(n_year)<3000) && (parseInt(n_year)>1970)
    )
    {
      month=parseInt(n_month);   
      year=parseInt(n_year);
    }
    
  }
  
  date=new Date(year, month-1, 1);
  var dow=date.getDay()-1;

  var today=new Date();
  
  
  var daysinmonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) daysinmonth[2] = 29;
  
  var nod=daysinmonth[month-1];
  
  
  content='<div id="calendar-close" onmouseover="this.style.cursor=\'pointer\';" onclick="document.getElementById(\'time_select\').style.visibility=\'hidden\';">X</div> ';

  content+='<div id="cal_tab"><table id="calendar_table" cellpadding="0" cellspacing="0" border="0">';

  content+='<tr><th>Po</th><th>Út</th><th>St</th><th>Čt</th><th>Pá</th><th class="weekend">So</th><th class="weekend">Ne</th></tr>';

  
  if (dow<0)
  {
    dow=dow+7;
  }
  
  for (i=1; i<=dow%7; i++)
  {
    if (1==i%7)
    {
      content+='</tr><tr>';
    }
    content+='<td>&nbsp;</td>'; 
  
  }
  
  
  for (i=dow+1; i<=nod+dow; i++)
  {
    if (1==i%7)
    {
      content+='</tr><tr>';
    }   
      
      if ( ((i-dow)==today.getDate()) && (month==(today.getMonth()+1)) && (year==(today.getYear()+1900)) )
      {
        css_class=' class="today"';
      }
      else
      if ( (i%7>5) ||  (0==i%7) )
      {
        css_class=' class="weekend"';
      }
      else
      {
        css_class='';
      }
    
    content+='<td'+css_class+'><span onmouseover="this.style.cursor=\'pointer\';" onclick="setDate2('+(i-dow)+', '+month+', '+year+', \''+obj+'\')">'+(i-dow)+'</a></td>';           
  }

  if (0!=(nod+dow)%7)
  {
    for (i=(nod+dow)%7; i<7; i++)
    {
      content+='<td'+css_class+'>&nbsp;</td>'; 
    }
  }

  content+='</tr>';   
  
  content+='</table></div>';   
  
  content+='<div id="month_year_select">';
  
  content+='<span class="left_arrow" style="padding-left: 15px;" onmouseover="this.style.cursor=\'pointer\';" onclick="calendar2('+(month-1)+', '+year+', \''+obj+'\')"><!-- --></span>';
   
  content+='<span class="month_select">'+monthName(month)+'</span>';
  
  content+='<span class="right_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendar2('+(month+1)+', '+year+', \''+obj+'\')"><!-- --></span>';
 
  content+='<div class="clear_both"><!-- --></div>';
 
  if (year>10)
  { 
    content+='<span class="left_long_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendar2('+month+', '+(year-10)+', \''+obj+'\')"><!-- --></span>';
  }

  if (year>1)
  {
    content+='<span class="left_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendar2('+month+', '+(year-1)+', \''+obj+'\')"><!-- --></span>';
  }
    

  content+='<span class="year_select">'+year+'</span>';
  
  if (year<4091) 
  {
    content+='<span class="right_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendar2('+month+', '+(year+1)+', \''+obj+'\')"><!-- --></span>';
  }

  if (year<5000) 
  {
    content+='<span class="right_long_arrow" onmouseover="this.style.cursor=\'pointer\';" onclick="calendar2('+month+', '+(year+10)+', \''+obj+'\')"><!-- --></span>';
  }
  content+='<div class="clear_both"><!-- --></div>';
  
  content+='</div>';
   
  document.getElementById('time_select').style.left=findPosX(document.getElementById(obj))+'px';
  document.getElementById('time_select').style.top=findPosY(document.getElementById(obj))+'px';
  document.getElementById('time_select').style.visibility='visible';
  document.getElementById('time_select').innerHTML=content;
}   











function childern(node)
{
  var result='';
  var i;

    result+=node.style.length;
  
  if (count>10000) 
  {
    return false;
  }
  
  count++;
  


  for (i=0; i<node.childNodes.length; i++)
  {
    result+=childern(node.childNodes[i]);
  }
  
  return result;
}


var count=0;

function inactive()
{
/*
  var tmp;
  var i;
//  document.bgColor='#dddddd';
  
  //alert(document.styleSheets[0].cssRules.length);
  
 // alert(document.childNodes.length);

//  for (i=0; i<document.childNodes.length; i++)
//  {
//    tmp+=childern(document.childNodes[i]);
//  }


  for (i=0; i<document.styleSheets[0].cssRules.length; i++)
  {
    tmp=document.styleSheets[0].cssRules[i].style.cssText;
    if ('color'==tmp.substring(0, 5))
    {
//      alert(tmp);
      document.styleSheets[0].cssRules[].cssText='color: rgb(10, 10, 10);';
    }    
  //  alert("Style sheet " + i + " is titled " + document.styleSheets[i].title);
  }
  

//  alert(tmp);

  //document.getElementById('page').style.background='#ddd';
  //document.getElementById('page').style.background='#ddd';
*/  
  
}


function openTree()
{

}


function getexpirydate(nodays){
 var UTCstring;
 Today = new Date();
 nomilli=Date.parse(Today);
 Today.setTime(nomilli+nodays*24*60*60*1000);
 UTCstring = Today.toUTCString();
 return UTCstring;
}
function setcookie(name,value,duration){
 document.cookie = 
  name+"="+escape(value)+
  ";expires="+getexpirydate(duration)+
  ";path=/";
}
function getcookie(name) {
 var cookiestring=""+document.cookie;
 var index1=cookiestring.indexOf(name);
 if (index1==-1) return ""; 
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length; 
 return unescape(
  cookiestring.substring(
   index1+name.length+1,index2 ));
}

function popInit(obj)
{
  if ('false'==getcookie(obj+'show'))
  {
    document.getElementById(obj).style.height='20px';
    document.getElementById(obj).style.overflow='hidden';
  }
}


function pop(obj)
{
  if (!document.getElementById(obj))
  {
    return false;
  }
  

  
  if ('hidden'==document.getElementById(obj).style.overflow)
  {
    setcookie(obj+'show', 'true', 365);
    document.getElementById(obj).style.height='200px';
    document.getElementById(obj).style.overflow='visible';
    document.getElementById(obj).style.height='';
  }
  else
  {
    setcookie(obj+'show', 'false', 365);
//    original[obj]['height']=document.getElementById(obj).offsetHeight;
    document.getElementById(obj).style.height='20px';
    document.getElementById(obj).style.overflow='hidden';
  }
}

function showTasks(where)
{
  if (oldid)
  {
    document.getElementById(oldid).innerHTML=oldhtml;
//    alert(oldhtml);
  }
  
  
  oldid=where.id;
  oldhtml=where.innerHTML;
  where.innerHTML+='</tr>'+document.getElementById('tasks'+where.id).innerHTML;
  
  alert(where.innerHTML);

}


function admin_help_show(objName, e)
{
//  document.getElementById(objName).style.left=e.clientX;
//  document.getElementById(objName).style.top=(e.clientY+40);
  document.getElementById(objName).style.visibility='visible';
}

function admin_help_hide(objName)
{
  document.getElementById(objName).style.visibility='hidden';
}

function customPreview(text, font)
{
  if (text)
  {
    document.getElementById('custom-preview').innerHTML='<img src="/font-preview.php?f='+font+'&t='+text+'" alt="'+text+'" />';
  }
  else
  {
    document.getElementById('custom-preview').innerHTML='';
  }
}



function busy(text)
{
  document.getElementById('busy').innerHTML=text;
  document.getElementById('curtain').style.display='block';
}

function ready()
{
  document.getElementById('curtain').style.display='none';
}


function checkICO2(object)
{
  busy('Vyhledávám informace<br /><br /><span style="font-size: .6em; cursor:pointer; text-decoration: underline;" onclick="xmlhttpICO=null; ready();">přerušit vyhledávání</span>');
  $.ajax({
    type: "GET",
    url: "/ajax/ico.php?ico="+object.value,
    success: onResponseICO
  });
}



function checkICO(object)
{
return false;


  busy('Vyhledávám informace<br /><br /><span style="font-size: .6em; cursor:pointer; text-decoration: underline;" onclick="xmlhttpICO=null; ready();">přerušit vyhledávání</span>');



obj=object;

xmlhttpICO=null;
if (window.XMLHttpRequest)
  {// code for IE7, Firefox, Mozilla, etc.
  xmlhttpICO=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE5, IE6
  xmlhttpICO=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttpICO!=null)
  {
  xmlhttpICO.onreadystatechange=onResponseICO;
//  alert('/ajax/ico.php?ico='+object.value);
  xmlhttpICO.open("GET", '/ajax/ico.php?ico='+object.value, true);
  xmlhttpICO.send(null);

  }
else
  {
  
  }

}




function onResponseICO(x)
{

return false;

var row; 
//  x=xmlhttpICO.responseXML.documentElement.getElementsByTagName("RESPONSE");

  row=x.split("\n");
  var data=new Array();
  var tmp=new Array();

  for (i=0; i<15; i++)
  {
    if (row[i])
    {
      tmp=row[i].split('~');
      data[tmp[0]]=tmp[1];
      row[i]='';
    }
    row=x.split("\n");

  }
  
  if (!data['OBCHODNI_FIRMA'])
  {
    alert('Nenalezen žádný záznam, zkontrolujte prosím správnost zadaného IČ');

    ready();
    return false;
  }
  
  if (!data['OBEC'])
  {
    data['OBEC']=data['NAZEV_OBCE'];
  }

  if (!data['NAZEV_ULICE'])
  {
    data['NAZEV_ULICE']=data['NAZEV_CASTI_OBCE'];
  }
  

  
  document.forms[0].company_name.value=data['OBCHODNI_FIRMA'];
  document.forms[0].street.value=data['NAZEV_ULICE']+' '+data['CISLO_DOMOVNI'];
  if ( (data['CISLO_ORIENTACNI']) )
  {
    document.forms[0].street.value+='/'+data['CISLO_ORIENTACNI'];
  }
  document.forms[0].zip.value=data['PSC'];
  
  
                                          
  for (i=0; i<document.forms[0].province.options.length; i++)
  {
    if (document.forms[0].province.options[i].value==data['KRAJ'])
    {
      document.forms[0].province.options[i].selected=true;
    }
  }
      icoRegion=data['OKRES'];
      
  
      document.getElementById('region').options.length=0;
      getList(document.getElementById('region'), 'regions', 'id_province', data['KRAJ'], '- Zvolte prosím kraj -', data['OKRES']);
  


alert('Nalezen záznam: '+data['OBCHODNI_FIRMA']);
  

  //.value=data['OBEC'];
//  document.forms[0].region.value=data['REGION'];
//  document.forms[0].province.value=data['KRAJ'];
  

  ready();
  
  document.forms[0].dic.focus();
    
 /* 
  for (i=0; i<x.length; i++)
  {
    xx=x[i].getElementsByTagName("ID");
    var id=xx[0].firstChild.nodeValue;
    xx=x[i].getElementsByTagName("NAME");
    var name=xx[0].firstChild.nodeValue;
      

      }
*/


}






function sleep(milliSeconds)
{
  var startTime = new Date().getTime(); // get the current time
  while (new Date().getTime() < startTime + milliSeconds); // hog cpu
}




function asp()
{
  if (document.getElementById('asp'))
  {
    document.getElementById('aspdiv').style.display='none';
    document.getElementById('asp').value='atlantis';
  }
} 




function ajaxHTML(page, caller, width, height, drag, id)
{ 
  ajaxCaller=caller;


  if (width)
  {
    winWidth=width;
  }
  else
  {
    winWidth=750;
  }
  
  if (height)
  {
    winHeight=height;
  }
  else
  {
    winHeight=500;
  }
  
  
  winDrag=drag;
  winId=id;
  
  xmlhttp=null;
  if (window.XMLHttpRequest)
    {// code for IE7, Firefox, Mozilla, etc.
    xmlhttp=new XMLHttpRequest();
    }
  else if (window.ActiveXObject)
    {// code for IE5, IE6
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  if (xmlhttp!=null)
  {
    xmlhttp.onreadystatechange=onResponseAjaxHTML;
    xmlhttp.open("GET",page,true);
    xmlhttp.send(null);
  }
  else
  {
    return false;
  }
}




function onResponseAjaxHTML()
{

var ok=true;
var x;
var xx;


//alert('Font s tímto názvem již existuje.');
if(xmlhttp.readyState!=4) return;
if(xmlhttp.status!=200)
  {
  return false;
  }


x=xmlhttp.responseText;
 
 
 
if (x)
{
  if ('<<reload>>'==x)
  {
    window.location.reload();
  }
  else if ('~'==x[0])
  {
   var f=x.substr(1, x.length-1);
   eval(f);    
  }
  else
  {
    var res=resolution();
  
//    x='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta http-equiv="content-language" content="en" /><meta name="resource-type" content="document" /><meta name="description" content="" /><meta name="keywords" content="" /><meta name="author" content="all:" /><meta name="robots" content="all" /><link href="/css/admin-style.css" media="screen" rel="stylesheet" type="text/css" /><link rel="stylesheet" href="/css/window.css" type="text/css" media="screen" /><script type="text/javascript" src="/js/admin.js"></script><script type="text/javascript" src="/js/multireference.js"></script><script type="text/javascript" src="/js/multifile.js"></script><script type="text/javascript" src="/ckeditor/ckeditor.js"></script><script type="text/javascript" src="/AjexFileManager/ajex.js"></script><script type="text/javascript" src="/js/window.js"></script></head><body>'+x+'</body></html>';
//   Effect.Fade(document.getElementById('banner-top-'+last)); 
//    Effect.Appear(document.getElementById('curtain'));
    document.getElementById('curtain').style.display='block';
    
    win=winOpen(winWidth, winHeight, Math.round(res[0]/2-winWidth/2), 50, x, winDrag, winId);
  
  }
}  


}





function ajaxContent(page, tar)
{ 
  
  target=tar;
  
  xmlhttp=null;
  if (window.XMLHttpRequest)
    {// code for IE7, Firefox, Mozilla, etc.
    xmlhttp=new XMLHttpRequest();
    }
  else if (window.ActiveXObject)
    {// code for IE5, IE6
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  if (xmlhttp!=null)
  {
   // alert(page);
    xmlhttp.onreadystatechange=onResponseAjaxContent;
    xmlhttp.open("GET",page,true);
    xmlhttp.send(null);
  }
  else
  {
    return false;
  }
}




function onResponseAjaxContent()
{



//alert('Font s tímto názvem již existuje.');
if(xmlhttp.readyState!=4) return;
if(xmlhttp.status!=200)
  {
  return false;
  }


x=xmlhttp.responseText;

//alert();

if (x)
{
//  target.parentinnerHTML=x;
  target.innerHTML=x;
}

//target.innerHTML='a';  


}




function getList2(o, list, f, v, e, d, k, em)
{

  if ((em) && (!v))
  {
    v='nul';
  }
  
  field=f;
  value=v;
  obj=o;
  empty=e;
  listDef=d;

  if (!value)
  {
    value='';
  }
  
  if (!k)
  {
    k='';
  }  
//section_id='';


  field=f;
  value=v;
  obj=o;
  empty=e;
  listDef=d;

//section_id='';
xmlhttpListT=null;
if (window.XMLHttpRequest)
  {// code for IE7, Firefox, Mozilla, etc.
  xmlhttpListT=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE5, IE6
  xmlhttpListT=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttpListT!=null)
  {
//  alert('/ajax/lists.php?t='+list+'&f='+field+'&v='+value+'&k='+k);
    xmlhttpListT.onreadystatechange=onResponseLists2;
    xmlhttpListT.open("GET",'/ajax/lists2.php?t='+list+'&f='+field+'&v='+value+'&ka='+k,true);
    xmlhttpListT.send(null);
  }
else
  {
    return false;
  }
  
  

}






function onResponseLists2()
{

  if(xmlhttpListT.readyState!=4) return;
                
  if(xmlhttpListT.status!=200)
  {
    return false;
  }



  
  var value, text, selected, sel, industry, x;

  //alert(xmlhttpListT.responseText);

  x=xmlhttpListT.responseXML.documentElement.getElementsByTagName("ITEM");
  
  
  if (obj)
  { 
    obj.options.length=0;
    var optn = document.createElement("OPTION");
    optn.text='- Zvolte -';
    optn.value='';
    obj.options.length=0;
    obj.options.add(optn);
    
  } 
  
  
 if (x.length)
 { 
  
  for (i=0; i<x.length; i++)
  {
    xx=x[i].getElementsByTagName("ID");
    var id=xx[0].firstChild.nodeValue;
    xx=x[i].getElementsByTagName("TEXT");
    var text=xx[0].firstChild.nodeValue;


/*      
      if (id==defaultRegion)
      {
        selected=' selected="selected"';
      }
      else
      {
        selected='';
      }
*/      
      var optn = document.createElement("OPTION");
      optn.text=text;
      optn.value=id;
      
      if (listDef==id)
      {
        optn.selected=true;
      }

  if (obj)
  {
    obj.options.add(optn);
  }

  if (document.getElementById('region-search'))
  { 
//    document.getElementById('region-search').options.add(optn);
  }

      
    }


  if (0==i)
  {
    obj.options.length=0;
    var optn = document.createElement("OPTION");
    optn.text=empty;
    optn.value='';
    obj.options.length=0;
    obj.options.add(optn);
  }
  }
  
  else
  {
  if (obj)
  { 
    obj.options.length=0;
    
    if (empty)
    {
      obj.options.length=0;
      var optn = document.createElement("OPTION");
      optn.text=empty;
      optn.value='';
      obj.options.length=0;
      obj.options.add(optn);

    }
    
  }    
  }
  
  return true;
}



function getSelected(obj)
{
  var opt=obj.options;
  var selected = new Array();
  for (i=0; i<opt.length; i++) 
  {
     if (opt[i].selected) 
     {
        selected.push(opt[i].value);
     }
  }
  return selected;
}


function multiselect(obj, limit)
{
  var sel=getSelected(obj);
  
  
  if (sel.length>limit)
  {
    domInput.selected=false; 
    return false;
  }
  else
  {
    return true;
  }
} 



function getList3(o, list, f, v, e, d)
{

  field=f;
  value=v;
  obj=o;
  empty=e;
  listDef=d;
  if (0==value.length)
  {
    obj.innerHTML='<option>- Zvolte obor -</option>';
    return false;
  }

//section_id='';
xmlhttpList2=null;
if (window.XMLHttpRequest)
  {// code for IE7, Firefox, Mozilla, etc.
  xmlhttpList2=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE5, IE6
  xmlhttpList2=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttpList2!=null)
  {
    xmlhttpList2.onreadystatechange=onResponseLists3;
    xmlhttpList2.open("GET",'/ajax/lists.php?t='+list+'&f='+field+'&va='+value,true);
    xmlhttpList2.send(null);
  }
else
  {
    return false;
  }
  
  

}


function inArray(needle, haystack) 
{
    var length = haystack.length;
    for(var i = 0; i < length; i++) 
    {
        if(haystack[i] == needle) 
        {
          return true;
        }
    }
    return false;
}


function inArray2(needle, haystack) 
{
    var length = haystack.length;
    for(var i = 0; i < length; i++) 
    {
        if(haystack[i][1] == needle[1]) 
        {
          return true;
        }
    }
    return false;
}


function onResponseLists3()
{

  if(xmlhttpList2.readyState!=4) return;

  if(xmlhttpList2.status!=200)
  {
    return false;
  }
  
  var vals=getSelected(obj);


  var value, text, selected, sel, industry;


  x=xmlhttpList2.responseXML.documentElement.getElementsByTagName("ITEM");
  
  obj.options.length=0;
  
  if (obj)
  { 
  /*
    obj.options.length=0;
    var optn = document.createElement("OPTION");
    optn.text='- Zvolte -';
    optn.value='';
    obj.options.length=0;
    obj.options.add(optn);
  */
  }  
      
      
            
 if (x.length)
 { 
  
  for (i=0; i<x.length; i++)
  {
    xx=x[i].getElementsByTagName("ID");
    var id=xx[0].firstChild.nodeValue;
    xx=x[i].getElementsByTagName("TEXT");
    var text=xx[0].firstChild.nodeValue;
      
      
      var optn = document.createElement("OPTION");
      optn.text=text;
      optn.value=id;
      optn.onmouseover=function() { domInput=this; };

      if (inArray(id, vals))
      {
        optn.selected=true;
      }

  if (obj)
  {
    obj.options.add(optn);
  }

  if (document.getElementById('region-search'))
  { 
//    document.getElementById('region-search').options.add(optn);
  }

      
    }


  if (0==i)
  {
    obj.options.length=0;
    var optn = document.createElement("OPTION");
    optn.text=empty;
    optn.value='';
    obj.options.length=0;
    obj.options.add(optn);
  }
  }
  
  else
  {
  if (obj)
  { 
    obj.options.length=0;
  }    
  }
  
  return true;
}



function resolution()
{
  var result=new Array;

  if (window.innerWidth) 
  {
      result[0]= window.innerWidth;
      result[1]=window.innerHeight;
  }
  else if (document.body.offsetWidth) 
 {
  result[0]= document.body.offsetWidth;
  result[1]=document.body.offsetHeight;
 }


  return result;

}

function newWindow(url,w,h){

	wasOpen  = false;
  if ( (0<w) && (0<h) )
  {
	 win = window.open(url,'detail','left='+(screen.width/2-w/2)+', top='+(screen.height/2-h/2)+', width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	}
	else
	{
    win = window.open(url);
  }
	win.focus();
  return (typeof(win)=='object')?true:false;

}    



function scrollToTop()
{
  document.getElementById('top-input').focus(); 
}



function sleep(milliSeconds)
{
    var startTime = new Date().getTime(); // get the current time
    while (new Date().getTime() < startTime + milliSeconds); // hog cpu
}





function getList(o, list, f, v, e, d)
{
    
  field=f;
  value=v;
  obj=o;
  empty=e;
  listDef=d;

//section_id='';
xmlhttpList=null;
if (window.XMLHttpRequest)
  {// code for IE7, Firefox, Mozilla, etc.
  xmlhttpList=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE5, IE6
  xmlhttpList=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttpList!=null)
  {
  
    xmlhttpList.onreadystatechange=onResponseLists;
    xmlhttpList.open("GET",'/ajax/lists.php?t='+list+'&f='+field+'&v='+value,true);
    xmlhttpList.send(null);
  }
else
  {
    return false;
  }
  

}


function onResponseLists()
{

  if(xmlhttpList.readyState!=4) return;

  if(xmlhttpList.status!=200)
  {
    return false;
  }
  


  var value, text, selected, sel, industry;


  x=xmlhttpList.responseXML.documentElement.getElementsByTagName("ITEM");

/*  
  if (obj)
  { 
    obj.options.length=0;
    var optn = document.createElement("OPTION");
    optn.text='- Zvolte -';
    optn.value='';
    obj.options.length=0;
    obj.options.add(optn);
  }  
*/  
  for (i=0; i<x.length; i++)
  {
    xx=x[i].getElementsByTagName("ID");
    var id=xx[0].firstChild.nodeValue;
    xx=x[i].getElementsByTagName("TEXT");
    var text=xx[0].firstChild.nodeValue;
/*      
      if (id==defaultRegion)
      {
        selected=' selected="selected"';
      }
      else
      {
        selected='';
      }
*/      
      var optn = document.createElement("OPTION");
      optn.text=text;
      optn.value=id;
      
      if (listDef==id)
      {
        optn.selected=true;
      }

  if (obj)
  {
    obj.options.add(optn);
  }

  if (document.getElementById('region-search'))
  { 
//    document.getElementById('region-search').options.add(optn);
  }

      
    }


  if (0==i)
  {
    obj.options.length=0;
    var optn = document.createElement("OPTION");
    optn.text=empty;
    optn.value='';
    obj.options.length=0;
    obj.options.add(optn);
  }             

  if (0<icoRegion)
  {
    var tmp=icoRegion;
    icoRegion=0;
      document.getElementById('city').options.length=0;
      getList(document.getElementById('city'), 'citys', 'id_region', tmp, '- Zvolte prosím okres -');
  }


  return 'ok';

}



function getListA(o, list, f, v, e, d)
{
    
  field=f;
  value=v;
  obj=o;
  empty=e;
  listDef=d;

//section_id='';
xmlhttpListA=null;
if (window.XMLHttpRequest)
  {// code for IE7, Firefox, Mozilla, etc.
  xmlhttpListA=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE5, IE6
  xmlhttpListA=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttpListA!=null)
  {
    xmlhttpListA.onreadystatechange=onResponseListsA;
    xmlhttpListA.open("GET",'/ajax/lists.php?t='+list+'&f='+field+'&v='+value,true);
    xmlhttpListA.send(null);
  }
else
  {
    return false;
  }
  

}


function onResponseListsA()
{

  if(xmlhttpListA.readyState!=4) return;

  if(xmlhttpListA.status!=200)
  {
    return false;
  }
  


  var value, text, selected, sel, industry;


  x=xmlhttpListA.responseXML.documentElement.getElementsByTagName("ITEM");

/*  
  if (obj)
  { 
    obj.options.length=0;
    var optn = document.createElement("OPTION");
    optn.text='- Zvolte -';
    optn.value='';
    obj.options.length=0;
    obj.options.add(optn);
  }  
*/  
  for (i=0; i<x.length; i++)
  {
    xx=x[i].getElementsByTagName("ID");
    var id=xx[0].firstChild.nodeValue;
    xx=x[i].getElementsByTagName("TEXT");
    var text=xx[0].firstChild.nodeValue;
/*      
      if (id==defaultRegion)
      {
        selected=' selected="selected"';
      }
      else
      {
        selected='';
      }
*/      
      var optn = document.createElement("OPTION");
      optn.text=text;
      optn.value=id;
      
      if (listDef==id)
      {
        optn.selected=true;
      }

  if (obj)
  {
    obj.options.add(optn);
  }

  if (document.getElementById('region-search'))
  { 
//    document.getElementById('region-search').options.add(optn);
  }

      
    }


  if (0==i)
  {
    obj.options.length=0;
    var optn = document.createElement("OPTION");
    optn.text=empty;
    optn.value='';
    obj.options.length=0;
    obj.options.add(optn);
  }

  return 'ok';

}


function formHint(obj, text)
{
  var nodes=obj.parentNode.childNodes;
  for (i=0; i<nodes.length; i++)
  {
    if ('hint'==nodes[i].className)
    {
      nodes[i].style.display='block';
    }
  }
}


function formHintHide(obj)
{
  var nodes=obj.parentNode.childNodes;
  for (i=0; i<nodes.length; i++)
  {
    if ('hint'==nodes[i].className)
    {
      nodes[i].style.display='none';
    }
  }
}


function formHint2(obj, text)
{
  var nodes=obj.parentNode.parentNode.childNodes;
  for (i=0; i<nodes.length; i++)
  {
    if ('hint'==nodes[i].className)
    {
      nodes[i].style.margin='0 0 0 200px';
      nodes[i].style.display='block';
    }
  }
}



function formHintHide2(obj)
{
  var nodes=obj.parentNode.parentNode.childNodes;
  for (i=0; i<nodes.length; i++)
  {
    if ('hint'==nodes[i].className)
    {
      nodes[i].style.display='none';
      nodes[i].style.margin='0 0 0 590px';
    }
  }
}


function findPos(obj) {
	var curleft = curtop = 0;

	if (obj.offsetParent) {

	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;

		} while (obj = obj.offsetParent);


	return [curleft,curtop];
}

}



function checkInput(input, reg, step)
{
  if (!input.value.match(reg))
  {
    if (step<formStep)
    {
      formStep=step;
    }
  }
  
  
  

}




function checkForm(form)
{
  
  var tmp;
  formStep=10;
  
  
  for (i=0; i<form.elements.length; i++)
  {
    if (form.elements[i].onunload)
    {
      form.elements[i].onunload();
    }
  }
  setFormSteps(form);
  
 //   alert(form.elements[i]);
  }
  
  
function setFormSteps(form)
{
           
  var div=form.childNodes[1];

  var els;
  var tmp;

  
  els=getElementsByClassName('curtain-form');

//        alert(els.length);
  for (i=0; i<els.length; i++)
  {
    if (els[i])
    { 
      els[i].style.display='none'; 
    //  els[i].parentNode.removeChild(els[i]);
    }
  }
  

  for (i=0; i<div.childNodes.length; i++)
  {
    for (j=formStep+1; j<10; j++)
    {
      if ('step-'+j==div.childNodes[i].className)
      {
        var cur=document.createElement('div');
        cur.className='curtain-form';
        cur.style.width='500px';
        cur.style.height=div.childNodes[i].offsetHeight+5+'px';
        cur.style.top=findPosY(div.childNodes[i])-5+'px';
        cur.style.left=findPosX(div.childNodes[i])-10+'px';

        div.childNodes[i].appendChild(cur);
//        div.childNodes[i].style.border='1px solid #f00'; 
      }
    }


}


}




window.multiInputRefresh=function(page, target)
{                         
  ajaxContent(page, target);
}


window.workPlacesRefresh=function()
{                    
  ajaxContent('/ajax/mista-prace/?j=6501', document.getElementById('place-select'));
}




  function jobPreview(form)
  {
    var height;
    
    if (window.innerHeight)
    { 
      height=window.innerHeight;
    }
    else
    {
      height=document.body.clientHeight;
    }
    
   if (document.getElementById('job-preview'))
   {
    document.getElementById('job-preview').style.height=height+'px';
    if (true==form)
    { 
      document.forms[0].action='/job-preview/'; 
      document.forms[0].target='job-preview'; 
      document.forms[0].submit();
    }
    document.getElementById('curtain').style.display='block';
    document.getElementById('job-preview').style.display='block';
    document.getElementById('job-preview-close').style.display='block';
    if (true==form)
    { 
      document.forms[0].action=''; 
      document.forms[0].target='';
    }
  }  
    
  }



  function jobPreviewClose()
  {
    document.getElementById('curtain').style.display='none';
    document.getElementById('job-preview').style.display='none';
    document.getElementById('job-preview-close').style.display='none';
  }




function creditsAlign()
{
  if ( (document.getElementById('content-right')) && (document.getElementById('top-tab')) && ('no_css'!=document.getElementById('content-right').className) )
  {
    document.getElementById('content-right').style.padding=(findPosY(document.getElementById('top-tab'))-findPosY(document.getElementById('content-right'))-37)+'px 0 0 5px';
    return true;
  }
  
  else if ( (document.getElementById('credits')) && (document.getElementById('top-tab')) )
  {
    document.getElementById('credits').style.margin=(findPosY(document.getElementById('top-tab'))-findPosY(document.getElementById('credits'))+1)+'px 0 0 745px';
    return true;
  }
  
  
  return false;
}



function cvNav()
{
  var width;
    if (window.innerwidth)
    { 
      width=window.innerWidth;
    }
    else
    {
      width=document.body.clientWidth;
    }

  if (document.getElementById('cv-sections'))
  {
    if (width<1350)
    {
      document.getElementById('cv-sections').style.display='none';  
    }
  }
  
  return true;
}




function redirect(id)
{

xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for IE7, Firefox, Mozilla, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE5, IE6
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.open("GET",'/ajax/redirect.php?id='+id,true);
  xmlhttp.send(null);
  }
else
  {
  
  }

}




function tabs()
{
  if (!document.getElementById('tabs'))
  {
    return false;
  }
  
  var ul=document.getElementById('tabs');
  var lis=new Array();
  

  
  for (i=0; i<ul.childNodes.length; i++)
  {
    if ('LI'==ul.childNodes[i].tagName)
    {
      lis.push(ul.childNodes[i]);
    }
  }
  
  var j, y, tmp, last, height, ulx, ulw;
  var steps=new Array();
  var lix=new Array();
                                
  ul.style.height=ul.offsetHeight+'px';
  ulw=ul.offsetWidth;
  ulx=findPosX(ul);
  
  for (i=0; i<lis.length; i++)
  {
    tmp=findPosY(lis[i])
    lix[i]=findPosX(lis[i])
    if (y!=tmp)
    {
      steps.push(i); 
      y=tmp;
    }
  }
  
  
  steps.push(i); 
  
  y=1;
  last=steps[steps.length-1];

  for (j=steps.length-1; j>0; j--)
  {
    for (i=steps[j-1]; i<steps[j]; i++)
    {
      lis[i].style.margin=y+'px 0 0 '+(lix[i]-ulx)+'px';
      lis[i].style.position='absolute';
      if ( (i==steps[j]-1) && (j<steps.length-1) )
      {
        lis[i].style.width=(ulw-(lix[i]-ulx))+'px';
      }
    }
    y+=31;
  }
  
  ul.style.visibility='visible';  
  

}



function setFtFl(type)
{

  var els;
  if ('fl'==type)
  {
  
    els=getElementsByClassName('job-ft');
    for (i=0; i<els.length; i++)
    {
      els[i].style.visibility='hidden';
      els[i].style.height='0';
    }
    els=getElementsByClassName('job-fl');
    for (i=0; i<els.length; i++)
    {
      els[i].style.visibility='visible';
      els[i].style.height='auto';
    }
    document.getElementById('job-type-info').innerHTML='Zadáváte brigádu.<br />Pracovní pozici na plný nebo zkrácený úvazek můžete zadat <span style="" onclick="setFtFl(\'ft\');">zde<span>';
    document.getElementById('brigada').value='Y';
  }
  
  else if ('ft'==type)
  {
    els=getElementsByClassName('job-fl');
    for (i=0; i<els.length; i++)
    {
      els[i].style.visibility='hidden';
      els[i].style.height='0';
    }
    els=getElementsByClassName('job-ft');
    for (i=0; i<els.length; i++)
    {
      els[i].style.visibility='visible';
      els[i].style.height='auto';
    }
    document.getElementById('job-type-info').innerHTML='Zadáváte pracovní pozici na plný nebo zkrácený úvazek.<br />Brigádu můžete zadat <span style="" onclick="setFtFl(\'fl\');">zde<span>';
    document.getElementById('brigada').value='N';
  }
  jobPrice();
}

function hide(obj)
{
  if (!document.getElementById(obj)) return false;
  document.getElementById(obj).style.display='none';
  return true;
}

function show(obj)
{
  if (!document.getElementById(obj)) return false;
  document.getElementById(obj).style.display='block';
  return true;
}



function jobPrice()
{
  var price=new Array();
  
  price[0]=price[1]=0;
  
  if (values['Mista_pracovistejob'])
  {
    price[0]+=values['Mista_pracovistejob'].length;
  }

  if (document.getElementById('whole-cr').checked)
  {
    price[0]=3;
  }

  
  if (document.getElementById('top-pr').checked)
  {
    price[1]+=price[0];
  }

  if (document.getElementById('top').checked)
  {
    price[1]+=price[0];
  }
  

  if (document.getElementById('anonymous').checked)
  {
    price[0]*=3;
  }
  
    
  if ('Y'==document.getElementById('brigada').value)
  {
    document.getElementById('price-total').innerHTML='Zdarma';
  }
  
  else
  {
    document.getElementById('price-total').innerHTML='Kreditů: '+price[0]+'<br />Portál kreditů: '+price[1]+'';
    document.getElementById('price-act').innerHTML='<p>Každá aktualizace posune inzerát ve výpise na přední místo.<br />Počet kreditů odečtených při každé pravidelné aktualizaci: '+price[0]+'</p>';
  }
  
}


function formSubmit(obj)
{
  var parent;
  
  parent=obj;
  
  while ((parent.parentNode))
  {
    if ('form'==parent.tagName.toLowerCase())
    {
      document.forms[parent.name].submit();
    }
    parent=parent.parentNode;
  }
  
  return false;


}



function childIndex(obj)
{
  if (!obj.parentNode)
  {
    return false;
  }
  
  for (i=0; i<obj.parentNode.childNodes.length; i++)
  {
    if (obj.parentNode.childNodes[i]==obj)
    {
      
      return i;
    }
  }
  
  return false;
}




function sliderStart()
{
  $('#slider').nivoSlider({
    effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
    animSpeed: 500, // Slide transition speed
    pauseTime: 10000  
  });
}





var obj;
var oldid;
var oldhtml;
var field;
var value;
var empty;
var listDef;
var formStep=10;
var ajaxCaller;
var target;
var ajaxTarget;
var domInput;
var xmlhttpList;
var xmlhttpListT;
var icoRegion;
