var prImages=new Array(2);prImages[0]=new Image();prImages[0].src="/i/btn-szukaj-on.gif";prImages[1]=new Image();prImages[1].src="/i/btn-wybierz-skladniki-on.gif";WL=window.location;var cj_wybSkMax=5;var cj_wybSkId=new Array(cj_wybSkMax);var cj_wybSkName=new Array(cj_wybSkMax);var cj_cursor=document.documentElement.style.cursor;var cj_do_save=1;var saved_no_sk=0;var cj_msgWait='<span style="color:red;">czekaj...</span>';var cj_msgErr='<span style="color:red;">błąd..., przeładuj strone</span>';var synch_cj_forum=0;var cj_sUrl="/inv/ajax/szukaj/wyszukiwarka-potraw.php";function cj_potrawa_druk(a){cj_w=window.open(a,"_blank","toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no,directories=no,width=800,height=700,right=0,bottom=0");cj_w.focus()}function trim(a){if(a==""){return a}a=a.replace(/^\s+|\s+$/,"");return a}function inv_updateAvailLength(c,b,a){elemVal=$(c);elemInfo=$(b);if(a>elemVal.value.length){elemInfo.innerHTML=(a-elemVal.value.length)}else{elemInfo.innerHTML=0;elemVal.value=elemVal.value.substr(0,a)}}function cj_forum_popup(a){cj_w=window.open(a,"_blank","toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no,directories=no,width=800,height=500,right=0,bottom=0");cj_w.focus()}function cj_forum_spot(){if(synch_cj_forum==1){return}synch_cj_forum=1;s=trim($("fsp").value);if(s==""){alert("Wpisz cokolwiek do pola");return}new Ajax.Request("/inv/ajax/forum/szukaj_potrawy.php",{method:"get",parameters:"s="+s,encoding:"UTF-8",onLoading:function(){cj_cursor="wait"},onSuccess:function(a){cj_cursor="auto";$("fsr").innerHTML=a.responseText;synch_cj_forum=0},onFailure:function(){cj_cursor="auto";synch_cj_forum=0}})}function zdjPop(a){window.open("/zdjeciePopup.php?img="+a,"_blank","width=640,height=480,scrollbars=1")}var cjLoadSkSelect_synch=0;var cjSkSelectSelected_synch=0;var cjSkMvToList_synch=0;var cjSkSend_synch=0;var cjSkSelMax=5;var cjSkWykMax=3;function cjSkT(a){if(a==1){return $("sows")}else{return $("sowk")}}function cjLoadSkSelect(b,a){if(cjLoadSkSelect_synch==1){return}cjLoadSkSelect_synch=1;params="";e=$("sowbCtn");if(a!=""){params="rid="+a}else{if(b!=""){params="s="+b}}if(params==""){cjLoadSkSelect_synch=0;return}new Ajax.Request("/inv/ajax/szukaj/sowb.php",{method:"get",parameters:params,encoding:"UTF-8",onLoading:function(){e.innerHTML=cj_msgWait},onSuccess:function(c){e.innerHTML=c.responseText;cjLoadSkSelect_synch=0},onFailure:function(){de.innerHTML=cj_msgErr;cjLoadSkSelect_synch=0}})}function cjSkSelectSelected(b,a){if(cjSkSelectSelected_synch==1){return}cjSkSelectSelected_synch=1;if(!cjSkCheckList(1,b)){$("btnSks").value="« "+a+" do wybranych";$("btnSksCnt").show()}if(!cjSkCheckList(2,b)){$("btnSkw").value="« "+a+" do wykluczonych";$("btnSkwCnt").show()}cjSkSelectSelected_synch=0}function cjSkCheckList(a,b){eCH=cjSkT(a);if(eCH.length<=0){return false}for(i=0;i<eCH.length;i++){if(eCH.options[i].value==b){return true}}return false}function cjSkHideMoveBtns(){$("btnSksCnt").hide();$("btnSkwCnt").hide()}function cjSkHideDelBtns(){$("btnSkusCnt").hide();$("btnSkukCnt").hide()}function cjSkMvFL(a){eMX=cjSkT(a);if(a==1&&eMX.length>=cjSkSelMax){alert("Lista składników do wyszukania jest pełna.");return}else{if(a==2&&eMX.length>=cjSkWykMax){alert("Lista składników do wykluczenia jest pełna.");return}}s=$("sowb");skid=s.options[s.selectedIndex].value;name=s.options[s.selectedIndex].innerHTML;cjSkMvToList(a,skid,name);cjSkHideMoveBtns();cjSkHideDelBtns();cjSkDesc();s.selectedIndex=-1}function cjSkRm(a,b){eRM=cjSkT(a);if(eRM.length<=0){return}for(i=0;i<eRM.length;i++){if(eRM.options[i].value==b){eRM.remove(i);return}}}function cjSkMvToList(b,c,a){if(cjSkMvToList_synch==1){return}cjSkMvToList_synch=1;eMV=cjSkT(b);if(!cjSkCheckList(b,c)){if(b==1){t2=2}else{t2=1}if(eMV){if(cjSkCheckList(t2,c)){cjSkRm(t2,c)}o=document.createElement("option");o.text=a;o.value=c;eMV.add(o,null)}}cjSkMvToList_synch=0}function cjSkSelToDel(a){eSD=cjSkT(a);txt=eSD.options[eSD.selectedIndex].innerHTML;if(a==1){$("btnSkus").value="usuń "+txt+" »";$("btnSkusCnt").show()}else{$("btnSkuk").value="usuń "+txt+" »";$("btnSkukCnt").show()}}function cjSkDelBtn(a){eBD=cjSkT(a);cjSkRm(a,eBD.options[eBD.selectedIndex].value);cjSkHideDelBtns();cjSkDesc();if(a==1){t2=2}else{t2=1}eBD2=cjSkT(t2);eBD2.selectedIndex=-1}function cjSkDesc(){eDSC=cjSkT(1);any=0;tmp=$("skDesc");if(eDSC.length>0){any=1;tmp.innerHTML=" zawierające składnik";if(eDSC.length>1){tmp.innerHTML+="i"}tmp.innerHTML+=": ";for(i=0;i<eDSC.length;i++){tmp.innerHTML+='<span class="k-nieb2">'+eDSC.options[i].innerHTML+"</span>";if(i<(eDSC.length-1)){tmp.innerHTML+=", "}}}eDSC=cjSkT(2);if(eDSC.length>0){if(any>0){tmp.innerHTML+=". Przepisy będą bez: "}else{tmp.innerHTML=" które nie zawierają: "}for(i=0;i<eDSC.length;i++){tmp.innerHTML+='<span class="k-czer">'+eDSC.options[i].innerHTML+"</span>";if(i<(eDSC.length-1)){tmp.innerHTML+=", "}}any=1}if(any>0){tmp.innerHTML="<b>Wyszukam dla Ciebie przepisy</b> "+tmp.innerHTML;tmp2=$("pfid");if(tmp2.options[tmp2.selectedIndex].value!=""){tmp.innerHTML+=". Poszukam tylko <b>"+tmp2.options[tmp2.selectedIndex].innerHTML.toLowerCase()+"</b>."}tmp.show()}else{tmp.innerHTML="";tmp.hide()}}function cjSkSend(){if(cjSkSend_synch==1){return}cjSkSend_synch=1;skList="";eSD1=cjSkT(1);if(eSD1.length>0){for(i=0;i<eSD1.length;i++){skList+=eSD1.options[i].value;if(i<(eSD1.length-1)){skList+=","}}}eSD2=cjSkT(2);if(eSD2.length>0){if(skList!=""){skList+=","}for(i=0;i<eSD2.length;i++){skList+="-"+eSD2.options[i].value;if(i<(eSD2.length-1)){skList+=","}}}if(skList!=""){skList="?sk="+skList}else{alert("Wybierz jakieś składniki");cjSkSend_synch=0;return}tmp2=$("pfid");if(tmp2.options[tmp2.selectedIndex].value!=""){skList+="&pfid="+tmp2.options[tmp2.selectedIndex].value}params="/wybierz-skladniki.php"+skList;window.location.href=""+params;cjSkSend_synch=0};