function RegisterInputsFocus(){inputs=$$("input");for(i=0;i<inputs.length;i++){if(inputs[i].type=="text"||inputs[i].type=="password"){Event.observe(inputs[i],"focus",function(A){new Element.addClassName(this,"input-focus")}.bind(inputs[i]));Event.observe(inputs[i],"blur",function(){new Element.removeClassName(this,"input-focus")}.bind(inputs[i]))}}textareas=$$("textarea");for(i=0;i<textareas.length;i++){textareas[i].onfocus=function(){new Element.addClassName((this),"input-focus")};textareas[i].onblur=function(){new Element.removeClassName((this),"input-focus")}}}var allInputs;function ReplaceChecks(){allInputs=$$("input");for(var B=0;B<allInputs.length;B++){if(allInputs[B].getAttribute("type")=="checkbox"){var A=document.createElement("img");if(allInputs[B].checked){A.src="/images/chkboxChecked.gif"}else{A.src="/images/chkboxUnchecked.gif"}A.id="chkImg"+B;A.onclick=new Function("OnCheckChange("+B+")");allInputs[B].parentNode.insertBefore(A,allInputs[B]);allInputs[B].style.display="none"}}}function OnCheckChange(A){if(allInputs[A].checked){allInputs[A].checked="";$("chkImg"+A).src="/images/chkboxUnchecked.gif"}else{allInputs[A].checked="checked";$("chkImg"+A).src="/images/chkboxChecked.gif"}}function AddEventToCheck(A,C){for(var B=0;B<allInputs.length;B++){if(allInputs[B].getAttribute("id")==A){$("chkImg"+B).onclick=new Function("OnCheckChange("+B+");"+C)}}}function ProcessSafeEmails(){var G=new Array();var D=new Array();G[G.length]="#";G[G.length]=",";D[D.length]="@";D[D.length]=".";var E=$$(".email");for(var C=0;C<E.length;C++){try{var B=E[C].innerHTML;a=B;for(k=0;k<a.length;k++){for(var A=0;A<G.length;A++){a=a.replace(G[A],D[A])}}E[C].innerHTML=a}catch(F){}}}function OnFormLoad(){ReplaceChecks();ProcessSafeEmails();RegisterHints();RegisterInputsFocus();RegisterMainSearchHint()}function RegisterHints(){var A=$$('input[rel="hint"]');for(var B=0;B<A.length;B++){try{Event.observe(A[B],"focus",function(){Effect.Appear(this.name+"_hint",{duration:0.6})}.bind(A[B]));Event.observe(A[B],"blur",function(){Effect.DropOut(this.name+"_hint",{duration:0.4})}.bind(A[B]))}catch(C){}}}function RegisterMainSearchHint(){var A=$("search");var B=$("searchBtn");if((A!=undefined)&&(B!=undefined)){hint="wpisz miasto, dzielnicę, typ nieruchomości...";if((A.value=="")||(A.value==hint)){Element.addClassName(A,"hint");A.value=hint;A.hintEvent=function(){this.value="";Element.removeClassName(this,"hint");Event.stopObserving(this,"focus",this.hintEvent)}.bind(A).bindAsEventListener(A);Event.observe(A,"focus",A.hintEvent);Event.observe(B,"click",function(){if($("search").value==hint){$("search").value=""}})}}}Event.observe(window,"load",OnFormLoad);