var agbFout="";var checkFrm=function(){return true};function gaNaarZI(a,b){if(pb){pb.hide()}if(checkFrm()){if(a=="opslaan"){$("profielfrm").action="/profiel/instellingen/opslaan"}else{$("profielfrm").action="/profiel/instellingen/"+$("mode").value+"/"+a}$("profielfrm").method="POST";$("profielfrm").submit()}if(b){Event.stop(b)}return false}var delMedewerker;function submitDiensten(){var a=$("diensten_form");if($F(a.diensten_callmenow)&&!checkEmail($F(a.diensten_callmenow_email))){foutFeedback("Voer alstublieft een geldig e-mailadres in waarop u de terugbelverzoeken wilt ontvangen");return false}if($F(a.diensten_info_aanvraag)&&!checkEmail($F(a.diensten_info_email))){foutFeedback("Voer alstublieft een geldig e-mailadres in waarop u de informatieaanvragen wilt ontvangen");return false}$("diensten_form").submit()}function setZIDiensten(){var a=false;if(geId("appointment_specialismen_input")){function f(g,h){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"appt_specialismen",modus:g,waarde:h},onSuccess:function(j){$("appointment_specialismen").update(j.responseText);i=0;while(geId("spec_item_del"+i)){$("spec_item_del"+i).observe("click",function(k){d(k,this.id)});i++}}})}function d(h,g){f("del",g);Event.stop(h)}function c(g){f("add",g)}f("first");new Autocomplete("appointment_specialismen_input",{serviceUrl:"/ajax?action=specialismen&subaction=specialismen",minChars:2,maxHeight:400,width:255,deferRequestBy:100,onSelect:function(h,g){c(h);$("appointment_specialismen_input").value="";a=true}});function e(g){if(g.keyCode==13){if(!a){c($("appointment_specialismen_input").value)}$("appointment_specialismen_input").value="";a=false}}$("appointment_specialismen_input").observe("keyup",e)}function b(h,g,j,k){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"toggleform",organization_id:h,form_type_id:g,aan:k,form_naam:j},onSuccess:function(m){var l=m.responseText.evalJSON(true);if(l.active==1){newStatus="ingeschakeld"}else{newStatus="uitgeschakeld";$(l.form_type_id+"-img").src="/siteimg/kruis.png";$(l.form_type_id+"-aan").hide();$(l.form_type_id+"-uit").show()}goedFeedback("Het formulier <i>"+l.formname+"</i> is nu "+newStatus)}})}$$(".form_toggle").each(function(g){g.observe("click",function(j){j.preventDefault();var h=j.target.readAttribute("rel").split(",");b(h[1],h[0],h[2],j.target.checked)})})}function setZIProfiel(){if(geId("zivorigestap")){function e(){if(checkFrm()){gaNaarZI("opslaan")}}if(geId("profiel_opslaan_2")){$("profiel_opslaan_2").observe("click",function(v){e();Event.stop(v)})}if($F("zivorigestap")=="zoek"){function u(){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"zizoek",plaats:$F("plaatsnaam"),organisatie:$F("naamorg")},onSuccess:function(v){$("zoekresult").update(v.responseText);pb=new Probox('[class="probox"]',"/siteimg/loading.gif")}})}$("zoekknop").observe("click",u);$("zoeken_toevoegen_knop").observe("click",function(){$("zoeken_toevoegen").show();$("zoeken_toevoegen_knop").hide()});new Autocomplete("plaatsnaam",{serviceUrl:"/ajax?action=zoekplaats",minChars:2,maxHeight:400,width:255,deferRequestBy:100,onSelect:function(w,v){}})}if($F("zivorigestap")=="1"){function a(){if(geId("ziprofiel_elevatorpitch")){var v={toolbar:"MedgidsMinimal",width:"410px",height:"60px",resize_enabled:false};CKEDITOR.replace("ziprofiel_elevatorpitch",v,geId("ziprofiel_elevatorpitch").value)}if(geId("omschrijving")){var v={toolbar:"MedgidsKnoppen",width:"410px",height:"170px",resize_enabled:false};CKEDITOR.replace("omschrijving",v,geId("omschrijving").value)}}a();checkFrm=function(){if(geId("category_id")&&$("category_id").value==""|$("category_id").value==-1){var v="Geef aan om wat voor type instelling het gaat. ";if($("category_input")!=""){v+="Het ingevoerde instellingstype wordt niet herkend."}foutFeedback(v);o();return false}if(geId("ziprofiel_naam")&&$("ziprofiel_naam").value.length<5){foutFeedback("Voer de juiste naam van de instelling in.");return false}if(geId("agb_blok")&&agbFout!=""){foutFeedback(agbFout);return false}return true};if(geId("category_input")){new Autocomplete("category_input",{serviceUrl:"/ajax?action=typeinstelling",minChars:2,maxHeight:400,width:255,deferRequestBy:100,onSelect:function(w,v){$("category_id").value=w;j(true)}})}function r(v){if(geId("agb_blok")){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"checkagb",agb:$("ziprofiel_agb").value},onSuccess:function(w){agbFout=trim(w.responseText);if(!v){if(agbFout==""){$("agb_blok").addClassName("trans");$("agb_blok").removeClassName("fout")}else{$("agb_blok").removeClassName("trans");$("agb_blok").addClassName("fout");foutFeedback(agbFout)}}}})}}function j(v){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"haalcategoryid",keyword:$("category_input").value},onSuccess:function(w){$("category_id").value=w.responseText;if(v){o()}}})}function o(){if(geId("category_blok")){if($("category_input").value==""|$("category_id").value==-1){$("category_blok").addClassName("fout")}else{$("category_blok").removeClassName("fout")}}}function c(){if(geId("ziprofiel_naam")){if($("ziprofiel_naam").value==""){$("naam_blok").addClassName("fout");return false}else{$("naam_blok").removeClassName("fout");return true}}}if(geId("category_blok")){j(false)}$("category_input").observe("blur",function(){j(true)});$("category_input").observe("keyup",function(){j(true)});if(geId("ziprofiel_naam")){$("ziprofiel_naam").observe("change",c)}if(geId("ziprofiel_agb")){$("ziprofiel_agb").observe("blur",function(){r()});r(true)}}if($F("zivorigestap")=="2"){var b=false;checkFrm=function(){if($F("ziprofiel_website")!=""){var v=/(https|http):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;if(!v.test($F("ziprofiel_website"))){$("ziprofiel_website").value="http://"+$F("ziprofiel_website")}if(!v.test($F("ziprofiel_website"))){foutFeedback("Voer een correcte URL in.");return false}}if(!b){foutFeedback("Klik op 'Zoeken' om postcode en huisnummer te controleren.");return false}if(geId("ziprofiel_straatdef")){if($F("ziprofiel_straatdef")==""){foutFeedback("Vul het juiste adres van deze instelling in.");return false}}return true};function h(){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"zoekadres",postcode:$("ziprofiel_postcode").value,huisnummer:$("ziprofiel_huisnummer").value},onSuccess:function(w){var v=w.responseText.evalJSON(true);if(v.status!=1){alert("Het adres kon niet worden gevonden. Controleer postcode en huisnummer en probeer het opnieuw.");b=false}else{$("ziprofiel_straatdef").value=v.straatnaam+" "+v.huisnummer+$("ziprofiel_toevoeging").value;$("ziprofiel_straat").value=v.straatnaam;$("ziprofiel_postcodedef").value=v.postcode;$("ziprofiel_plaatsdef").value=v.woonplaats;$("ziprofiel_postcode").value=v.postcode;$("ziprofiel_huisnummer").value=v.huisnummer;$("bezoek_open").hide();$("bezoek_dicht").show();b=true}}})}if(geId("ziprofiel_straatdef")&&$("ziprofiel_straatdef").value!=""){b=true;$("bezoek_open").hide();$("bezoek_dicht").show()}function t(v){b=false;$("bezoek_open").show();$("bezoek_dicht").hide();Event.stop(v)}if(geId("ziprofiel_straatdef")){$("ziprofiel_bezoek_wijzig").observe("click",t);$("ziprofiel_pczoek").observe("click",h);$("ziprofiel_toevoeging").observe("blur",h)}}if($F("zivorigestap")=="5"){function d(x,w,v){if(geId("behandeling_input")){$("behandeling_input").value=""}var y=new Date();if(x!=undefined){p={action:"behandelingen",del:v,behandelingen_id:x,beh_naam:w}}else{p={action:"behandelingen"}}new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:p,onSuccess:function(z){$("behandelingen_lijst").update(z.responseText);i=0;while(geId("beh_item_del"+i)){$("beh_item_del"+i).observe("click",function(A){Event.stop(A);s(this)});i++}}})}function f(w,v){d(w,v)}function s(w){var x=w.id;var v=w.rel;Effect.BlindUp($(x.replace("beh_item_del","beh_item_div")),{duration:0.2,afterFinish:function(){d(parseInt(x.replace("beh_item_del","")),"",true)}});goedFeedback("Behandeling <i>"+v+"</i> verwijderd.")}if(geId("profiel_kbopenlijst")){$$(".kbitem").each(function(v){v.observe("click",function(w){Event.stop(w);f(v.rel,v.innerHTML)})});$("profiel_kbopenlijst").observe("click",function(v){Event.stop(v);$("profiel_kblijst").show()})}if(geId("behandelingen_lijst")){d();new Autocomplete("behandeling_input",{serviceUrl:"/ajax?action=behandelingen&subaction=behandeling",minChars:2,maxHeight:400,width:255,deferRequestBy:100,onSelect:function(w,v){$("behandeling_input").value="";f(v,w)},onEmpty:function(v){if(v.length<4){foutFeedback("Kies een behandeling uit de lijst of voer een nieuwe behandeling in.")}else{f(-1,v)}}})}}if($F("zivorigestap")=="3"){function q(x,w,v){var y=new Date();if(x!=undefined){p={action:"specialismen",del:v,specialisme_id:x,spec_naam:w}}else{p={action:"specialismen"}}new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:p,onSuccess:function(z){$("specialismen_lijst").update(z.responseText);i=0;while(geId("spec_item_del"+i)){$("spec_item_del"+i).observe("click",function(){m(this.id)});i++}}})}function l(w,v){q(w,v)}function m(v){q(parseInt(v.replace("spec_item_del","")),"",true)}if(geId("specialisme_input")){q();new Autocomplete("specialisme_input",{serviceUrl:"/ajax?action=specialismen&subaction=specialismen",minChars:2,maxHeight:400,width:255,deferRequestBy:100,onSelect:function(w,v){$("specialisme_input").value="";l(v,w)}})}}if($F("zivorigestap")=="4"&&geId("organization_id")){delMedewerker=function(w,v){Event.stop(w);new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"zi_zv_gekoppeld",sub:"del",ind_id:v,organization_id:$("organization_id").value},onSuccess:function(x){pb.hide();$("ziprofiel_zv_gekoppeld").update(x.responseText)}})};function n(){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"zi_zv_gekoppeld",sub:"koppel",ind_id:$("ind_id").value,organization_id:$("organization_id").value},onSuccess:function(v){pb.hide();$("ziprofiel_zv_gekoppeld").update(v.responseText);$("profiel_zoek_res").update();$("zoek_naam").value="";$("zoek_plaats").value="";$("zoek_specialisme").value=""}})}setupKnopHandlers=function(){if(geId("pb_cancel")){$("pb_cancel").observe("click",function(){pb.hide()})}if(geId("zizvkoppel_koppelen")){$("zizvkoppel_koppelen").observe("click",n)}};function g(){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"zvzoek",modus:2,profiel_achternaam:$F("zoek_naam"),profiel_plaats:$F("zoek_plaats"),profiel_specialisme_id:$F("zoek_specialisme_id"),profiel_specialisme:$F("zoek_specialisme")},onSuccess:function(v){$("profiel_zoek_res").update(v.responseText);pb=new Probox('[class="probox"]',"/siteimg/loading.gif")}})}function k(){new Ajax.Request("/ajax",{evalScripts:true,method:"get",parameters:{action:"zi_zv_gekoppeld",organization_id:$("organization_id").value},onSuccess:function(v){$("ziprofiel_zv_gekoppeld").update(v.responseText)}})}if(geId("profiel_zoek_btn")){$("profiel_zoek_btn").observe("click",g)}if(geId("zoek_specialisme")){new Autocomplete("zoek_specialisme",{serviceUrl:"/ajax?action=specialismen&subaction=specialismen",minChars:2,maxHeight:400,width:255,deferRequestBy:100,onSelect:function(w,v){$("zoek_specialisme_id").value=v}})}k()}if(geId("knop_werkervaring")){$("knop_werkervaring").observe("click",function(v){gaNaarZI(3,v)})}if(geId("ziprofiel_menu_stap1")){$("ziprofiel_menu_stap1").observe("click",function(v){gaNaarZI(1,v)});$("ziprofiel_menu_stap2").observe("click",function(v){gaNaarZI(2,v)});$("ziprofiel_menu_stap3").observe("click",function(v){gaNaarZI(3,v)});$("ziprofiel_menu_stap4").observe("click",function(v){gaNaarZI(4,v)});$("ziprofiel_menu_stap5").observe("click",function(v){gaNaarZI(5,v)})}if(geId("knop_terug")){$("knop_terug").observe("click",function(v){gaNaarZI(parseInt($F("zivorigestap"))-1,v);return false})}if(geId("knop_volgende")){$("knop_volgende").observe("click",function(v){gaNaarZI(parseInt($F("zivorigestap"))+1,v);return false})}}};
