function submit_new(ID){document.form1.cid.value=ID;document.form1.submit()}function submit_new(CID,ID){var el=document.getElementById(CID);el.value=ID;el.form.submit()}function submit_new_typ(ID,TYP){document.form1.typ.value=TYP;submit_new(ID)}function stepsubmit(ID){document.steps.step.value=ID;document.steps.submit()}function getObj(name){if(document.getElementById){this.obj=document.getElementById(name);this.style=this.obj.style}else if(document.all){this.obj=document.all[name];this.style=document.all[name].style}else if(document.layers){this.obj=document.layers[name];this.style=document.layers[name]}}function findPosY(obj){var curtop=0;if(obj.offsetParent){while(obj.offsetParent){curtop+=obj.offsetTop;obj=obj.offsetParent}}else if(obj.y)curtop+=obj.y;return curtop}function do_display(div,div2,radio){cn=document.getElementById(div);if(div2!="")cn2=document.getElementById(div2);if(document.form1[radio][1].checked){cn.style.display='block';if(div2!="")cn2.style.display='none'}else{cn.style.display='none';if(div2!="")cn2.style.display='block'}}function show_div(div,offset_el){var btn=new getObj(offset_el);var cn=new getObj(div);var top=findPosY(btn.obj);cn.style.top=top-395+'px';stav=(cn.style.visibility=='visible'?'hidden':'visible');ziv_id=(cn.style.visibility!='visible'?'ziv_volna':'');cn.style.visibility=stav;togle_zivnost(ziv_id)}function togle_zivnost(visible_id){var zivnosti=["ziv_volna","ziv_vazana","ziv_koncesovana","ziv_remeslna"];for(var div in zivnosti){var obj=new getObj(zivnosti[div]);if(zivnosti[div]!=visible_id){obj.style.visibility='hidden';obj.style.display='none'}else{obj.style.visibility='visible';obj.style.display='block'}}}function platba_radio(radio,div){show=(radio.value==3&&radio.checked);div=document.getElementById(div);div.style.display=show?'block':'none'}function cinnost_submit(action,id){document.form1.action.value=action;document.form1.id.value=id;checkForm.disablecheck=true;document.form1.submit()}function select_switch_rows(select,first,second){visible=select.options[select.selectedIndex].value;el=new Array();el[first]=document.getElementById(first);el[second]=document.getElementById(second);for(g in el){for(i=0;i<el[g].rows.length;i++){if(g==visible){el[g].rows[i].style.display=document.all?'block':'table-row'}else{el[g].rows[i].style.display='none'}}}}function do_checkbox(element){show=false;for(var i=1;i<arguments.length;i++){el=document.form1[arguments[i]];if(el!=null&&el.checked){show=true}}div=document.getElementById(element);if(div!=null)div.style.display=show?'block':'none';return show}function loadSubjekt(subj,targetID){var xmlHttp;try{xmlHttp=new XMLHttpRequest()}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){alert("Your browser does not support AJAX!");return false}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){var tbody=$('os'+targetID);if(!document.all)xmldoc=xmlHttp.responseXML;else{xmldoc=new ActiveXObject("Microsoft.XMLDOM");xmldoc.async=false;xmldoc.loadXML(xmlHttp.responseText)}var arr=xmldoc.documentElement.getElementsByTagName('item');for(var i=0;i<arr.length;i++){var item=arr[i].childNodes;var fname="";var fvalue="";for(var ii=0;ii<item.length;ii++){if(item[ii].childNodes.length>0){if(item[ii].nodeName=="name")fname=item[ii].childNodes[0].nodeValue;if(item[ii].nodeName=="value")fvalue=item[ii].childNodes[0].nodeValue}}changeValue(tbody,fname,fvalue)}if($('switchos')!=false){$('switchos').value=targetID;switchdisp_os()}}};xmlHttp.open("GET","/include/loadSubjekt.php?oid="+subj+"&typ="+targetID,true);xmlHttp.send(null)}function switchdisp_os(){var val=$('switchos').value;if(val=='fyzicka')$('osfyzicka').style.display='block';else $('osfyzicka').style.display='none';if(val=='pravnicka')$('ospravnicka').style.display='block';else $('ospravnicka').style.display='none'}function changeValue(con,name,value){inp=con.getElementsByTagName("input");for(i=0;i<inp.length;i++)if(inp[i].getAttribute("name")==name){inp[i].value=value;return}}function do_posta(){var ret=do_checkbox('upozorneni','upozorneni[sms]','upozorneni[telefon]','upozorneni[telefon_zahranici]','upozorneni[email]','preposilani[obycejne]','preposilani[doporucene]','preposilani[osobne]');el_pos=document.form1.posta_all;if(!ret&&el!=null&&el_pos.checked)el_pos.click()}function do_upozorneni(){return do_checkbox('upozorneni','upozorneni[sms]','upozorneni[telefon]','upozorneni[email]')}
