
var _uploadDialog=pilifs.yui.BaseDialog.extend({constructor:function(){id="uploadDialog";this.elIframe=document.getElementById("uploadIframe");var elIframe=this.elIframe;var config={};config.buttons=[{text:this.elIframe.getAttribute("closeLabel"),handler:function(){var frm=elIframe.firstChild;var frmDoc=typeof frm.contentDocument!="undefined"?frm.contentDocument:frm.contentWindow.document;if(frmDoc.getElementById("priloha")){var typ=frmDoc.getElementById("typ").value;document.getElementById("del-"+typ).style.display="inline";document.getElementById("view-"+typ).style.display="inline";document.getElementById("lb-"+typ).setAttribute("idprilohy",frmDoc.getElementById("priloha").value);}
this.cancel();},isDefault:true}];config.fixedcenter=true;config.width="400px";this.base(id,config);this.getId(id).style.display='block';var buttonLabel=this.elIframe.getAttribute("buttonLabel");var idpartnera=document.forms.fmReg.idpartneri.value;var confDelete=this.elIframe.getAttribute("delQuestion");this.extend({show:function(msg){this.base();var frm=document.createElement("IFRAME");if(this.elIframe.hasChildNodes())this.elIframe.removeChild(this.elIframe.firstChild);this.elIframe.appendChild(frm);var lb=document.getElementById("lb-"+msg);var idprilohy=lb.getAttribute("idprilohy");var html="<html><body><head><link rel='stylesheet' type='text/css' href='/css/reset-font-grids.css'><link rel='stylesheet' type='text/css' href='/css/iframe.css'></head>"+"<form name='upload' action='?ajax' method='POST' enctype='multipart/form-data' >"+"<div><h4>Příloha: "+lb.innerHTML+"</h4></div>"+"<input name='typUpload' type='hidden' value='"+msg+"'/>"+"<input name='idpartneri' type='hidden' value='"+idpartnera+"'/>"+"<input name='idprilohypartnera' type='hidden' value='"+idprilohy+"'/>"+"<div><input name='priloha' type='file'/>"+"<input type='submit' name='upload' onclick='return submitClick()' value='"+buttonLabel+"'/>"+"<script type='text/javascript'>"+"function submitClick() { document.upload.style.display='none'; document.getElementById('progress').style.display='block'; return true; }"+"</script>"+"</div></form>"+"<div id='progress' style='display:none'><img src='/images-new/preloader.gif' /></div>"+"</body></html>";var frmDoc=typeof frm.contentDocument!="undefined"?frm.contentDocument:frm.contentWindow.document;frmDoc.write(html);},deletePriloha:function(msg){if(confirm(confDelete)){var lb=document.getElementById("lb-"+msg);var idprilohy=lb.getAttribute("idprilohy");var callback={onSuccess:function(data){result=YAHOO.lang.JSON.parse(data);if(result.Error){window.errorDialog.show(result.Message);}
else{document.getElementById("del-"+msg).style.display="none";document.getElementById("view-"+msg).style.display="none";lb.setAttribute("idprilohy","");window.infoDialog.show("ok");}},onError:function(){alert('Doslo k chybe!');}};var a=new Ajax(callback);a.connect("?ajax=priloha&del="+idprilohy);}},viewPriloha:function(msg){var lb=document.getElementById("lb-"+msg);var idprilohy=lb.getAttribute("idprilohy");if(msg=="logo"){window.open("/download?t=view&id="+idprilohy,"logo","height=300,width=300,location=no,toolbar=no,menubar=no");}
else{window.location="/download?id="+idprilohy;}}});}});var RegisterForm=function(){var frm=document.forms.fmReg;var btSubmit=frm["Save"];var otherAddress_click=function(){var inputs=new Array("ulice","obec","psc","kodzeme");var prefix=this.getAttribute("prefix");for(var i=0;i<inputs.length;i++){var el=document.forms.fmReg[prefix+"-"+inputs[i]];el.disabled=!this.checked;if(!this.checked)el.value="";};};if(frm["pravidla"]){frm["pravidla"].onclick=function(){btSubmit.disabled=!this.checked;};btSubmit.disabled=true;}
frm["f-jina"].onclick=otherAddress_click;frm["k-jina"].onclick=otherAddress_click;var valid=new Validation('fmReg',{immediate:true});Validation.addAllThese([['required4','Min. 4 znaky.',{minLength:4}],['required2','Min. 2 znaky.',{minLength:2}],['validate-password','Heslo musí mít minimálně 6 znaků a nesmí být shodné jako jméno.',{minLength:6,notOneOf:['password','PASSWORD','1234567','0123456'],notEqualToField:'login'}],['validate-password-confirm','Potvrzovací heslo neodpovídá.',{equalToField:'heslo'}]]);if(document.getElementById("uploadDialog")){var uploadDialog=new _uploadDialog();uploadDialog.init();document.getElementById("uploadLogo").onclick=function(){uploadDialog.show("logo");};document.getElementById("uploadReg").onclick=function(){uploadDialog.show("reg");};document.getElementById("uploadZiv").onclick=function(){uploadDialog.show("ziv");};document.getElementById("uploadKon").onclick=function(){uploadDialog.show("kon");};document.getElementById("uploadOr").onclick=function(){uploadDialog.show("or");};document.getElementById("uploadPoj").onclick=function(){uploadDialog.show("poj");};document.getElementById("uploadjine1").onclick=function(){uploadDialog.show("jine1");};document.getElementById("uploadjine2").onclick=function(){uploadDialog.show("jine2");};document.getElementById("del-logo").onclick=function(){uploadDialog.deletePriloha("logo");};document.getElementById("del-reg").onclick=function(){uploadDialog.deletePriloha("reg");};document.getElementById("del-ziv").onclick=function(){uploadDialog.deletePriloha("ziv");};document.getElementById("del-kon").onclick=function(){uploadDialog.deletePriloha("kon");};document.getElementById("del-or").onclick=function(){uploadDialog.deletePriloha("or");};document.getElementById("del-poj").onclick=function(){uploadDialog.deletePriloha("poj");};document.getElementById("del-jine1").onclick=function(){uploadDialog.deletePriloha("jine1");};document.getElementById("del-jine2").onclick=function(){uploadDialog.deletePriloha("jine2");};document.getElementById("view-logo").onclick=function(){uploadDialog.viewPriloha("logo");};document.getElementById("view-reg").onclick=function(){uploadDialog.viewPriloha("reg");};document.getElementById("view-ziv").onclick=function(){uploadDialog.viewPriloha("ziv");};document.getElementById("view-kon").onclick=function(){uploadDialog.viewPriloha("kon");};document.getElementById("view-or").onclick=function(){uploadDialog.viewPriloha("or");};document.getElementById("view-poj").onclick=function(){uploadDialog.viewPriloha("poj");};document.getElementById("view-jine1").onclick=function(){uploadDialog.viewPriloha("jine1");};document.getElementById("view-jine2").onclick=function(){uploadDialog.viewPriloha("jine2");};}}
YAHOO.util.Event.addListener(window,"load",function(){new RegisterForm();document.getElementById('nazev').focus();});