jQuery.fn.extend({litebox:function(b){function d(){var e=$(document).data("_litebox_zIndex");if(e==undefined){e=400000}$(document).data("_litebox_zIndex",e+1);return e}var a=$(this).wrap("<div class=litebox></div>").parent().hide();$(this).wrap("<div class=inner-litebox></div>");$(this).show();function c(g){var e=g.width();var f=g.height();g.css("left",(($(window).width()-e)/2)+"px").css("top",(($(window).height()-f)/2)+"px");$(".litebox-top,.litebox-bottom",g).css("width",e+"px");$(".litebox-left,.litebox-right",g).css("height",f+"px")}a.each(function(){var e=$(this);if($.browser.msie&&($.browser.version<8)&&b&&b.width){e.css("width",b.width+"px")}e.prepend("<div class=litebox-top /><div class=litebox-right /><div class=litebox-bottom /><div class=litebox-left /><div class=litebox-topleft /><div class=litebox-topright /><div class=litebox-bottomleft /><div class=litebox-bottomright /><div class=litebox-close title=Sluiten />");e.hide().css("position","fixed").bind("hide",function(f){if(f.result==undefined){f.result=true}if(f.result){e.next().remove();e.hide()}return f.result}).bind("cancel",function(f){if(f.result==undefined){f.result=true}if(f.result){e.trigger("hide")}return f.result}).bind("show",function(i,f,j){if(e.is(":visible")){return false}var g=40;var h="#ffffff";if(b){if(b.opacity){g=b.opacity}if(b.bgColor){h=b.bgColor}}e.after("<div style='position: fixed; top: 0px; left: 0px; width: 100%; height: 100%; filter: alpha(opacity="+g+"); background-color: "+h+"; opacity: "+(g/100)+"; z-index: "+d()+";'></div>").css("z-index",d()).show().focus();c(e);return false}).find("[id^='cancel']:last").add(".litebox-close",e).bind("click",function(){e.trigger("cancel")})});$(window).bind("resize",function(){a.each(function(){if($(this).is(":visible")){c($(this))}})});return a},disableSelection:function(){this.each(function(){this.onselectstart=function(){return false};this.unselectable="on";jQuery(this).css("-moz-user-select","none")});return this},disableContextMenu:function(){this.each(function(){$(this).bind("contextmenu",function(a){a.stopPropagation();return false})});return this},scrollIntoView:function(){this.each(function(){this.scrollIntoView()});return this},scrollTo:function(a,b){this.each(function(){this.scrollLeft=a;this.scrollTop=b});return this},isChildOf:function(a){return jQuery(this).parents().filter(a).length>0},externalLink:function(a){this.each(function(){var c=$(this).attr("href");if(c){c=c.toLowerCase();var b=c.indexOf("://");if(b>=0&&b<8){$(this).attr("title",$(this).attr("title").length>0?($(this).attr("title")+(a?a:"")):"").attr("target","_blank")}}});return this},watermark:function(c,a,f,b){if(c){function e(g){g.next().hide()}function d(g){if(g.val()==""){g.next().show()}}this.each(function(){$(this).wrap("<div style='position: relative;'></div>");var g=$("<div class=watermark style='display: none; position: absolute; left:"+(a?a:3)+"px; "+(b?"width: "+b+"px; ":"")+"top:"+(f?f:1)+"px; white-space: normal;'>"+c+"</div>");g.disableSelection().bind("mousedown mouseup click focus",function(){$(this).prev().focus()});$(this).after(g).bind("focus",function(){e($(this))}).bind("blur",function(){d($(this))});d($(this))})}else{this.each(function(){if($(this).next().hasClass("watermark")){if($(this).val()==""){$(this).next().show()}else{$(this).next().hide()}}})}return this},checked:function(a){if(a==undefined){return this.attr("checked")}else{this.filter(":checkbox").each(function(){$(this).attr("checked",a?"checked":"")});return this}},numericMask:function(b){var a=[48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105];this.textMask(b?b.concat(a):a);return this},alphaNumericMask:function(b){var d="abcdefghiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var a=[];for(var c=0;c<d.length;c++){a.push(d.charCodeAt(c))}this.numericMask(b?b.concat(a):a);return this},textMask:function(a){this.filter(":text").keypress(function(c){var b=c.keyCode?c.keyCode:c.which;if($.inArray(b,a)>=0){return true}return false});return this},litebox2:function(a){if(!$.litebox){$.litebox={};$.litebox.defaults={title:"Litebox",defaultButton:0,okText:"OK",cancelText:"Annuleren",form:false};$.litebox.globals={zIndex:10000,resize:function(c){if((c==undefined)||!(c instanceof jQuery)){c=$(".litebox")}c.each(function(){var l=$(this),i=l.data("litebox"),j=$(window),h=j.height(),m=$(".litebox-content",l);var k=m[0].scrollHeight;var f=h-140;if(k>f){m.css("overflow","hidden").css("overflow-y","scroll").css("height",f+"px")}else{m.css("overflow","").css("overflow-y","").css("height","")}var g=l.height();var e=Math.round((j.width()-l.width())/2)-8;var d=Math.round((h-g)/2-7);l.css("left",e+"px").css("top",d+"px");i._shadow.css("left",e+"px").css("top",d+"px").css("width",l.width()+"px").css("height",g+"px")})},show:function(c){c.each(function(){var e=$(this),f=e.data("litebox");e.before(f._background).before(f._shadow)});$.litebox.globals.resize(c.show());var d=c.last();$(":button:eq("+d.data("litebox").settings.defaultButton+")",d.data("litebox")._footer).focus()},hide:function(c){c.each(function(){var d=$(this),e=d.data("litebox");if(e.settings.close){e.settings.close()}e._shadow.remove();e._background.remove()});c.hide()},remove:function(c){c.each(function(){var d=$(this),e=d.data("litebox");e._shadow.remove();e._background.remove()});c.remove()}};$(window).bind("resize.litebox",$.litebox.globals.resize)}var b={};if(typeof a==="string"){$.litebox.globals[a](this)}else{this.each(function(){var c=$(this),e=c.data("litebox"),g=e==undefined;if(g){function d(h){$("body").focus();var i=true;if(h){i=h();if((i===undefined)||(i==null)){i=true}}if(i){$.litebox.globals.hide(c)}}function f(i){var h=i.keyCode?i.keyCode:i.which;if(h==27){d(a.cancel);return false}}a=$.extend(b,$.litebox.defaults,a);e={settings:a,_content:$("<div class=litebox-content />"),_header:$("<div class=litebox-header><span/></div>"),_footer:$("<div class=litebox-footer/>"),_close:$("<div class=litebox-close/>"),_ok:$("<input type=button />").click(function(){d(a.ok)}),_cancel:$("<input type=button />").click(function(){d(a.cancel)}),_background:$("<div class=litebox-background style='z-index:"+($.litebox.globals.zIndex++)+"' />").bind("keydown",f),_shadow:$("<div class=litebox-shadow style='z-index:"+($.litebox.globals.zIndex++)+"' />").bind("keydown",f)};if(c.attr("style")){e._content.attr("style",c.attr("style"))}e._footer.append(e._ok).append(e._cancel);e._header.append(e._close.click(function(){e._cancel.trigger("click")}));$("input[type='text'], input[type='password']",c).live("keydown",function(i){var h=i.keyCode?i.keyCode:i.which;if(h==13){e._ok.trigger("click");return false}});c.removeAttr("style").data("litebox",e).addClass("litebox").wrapInner(e._content).prepend(e._header).append(e._footer).css("z-index",$.litebox.globals.zIndex++).attr("tabindex",0).css("-moz-outline-style","none").bind("keydown",f);if(e.settings.form){c.wrapInner("<form></form>")}c[0].hideFocus=true;if(c.is(":visible")){$.litebox.globals.show(c)}}else{e.settings=$.extend(b,$.litebox.defaults,e.settings,a)}$("span",e._header).text(e.settings.title);if(e.settings.okText){e._ok.val(e.settings.okText)}else{e._ok.hide()}if(e.settings.cancelText){e._cancel.val(e.settings.cancelText)}else{e._cancel.hide()}$.litebox.globals.resize(c)})}return this}});jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};Number.prototype.padLeft=function(a){return(this+Math.pow(10,a)).toString().substr(1)};Number.prototype.toFileSize=function(){return Math.ceil(this/1024)+" KB"};Date.prototype.toCustomString=function(b){var a=b;a=a.replace("dd",this.getDate().padLeft(2));a=a.replace("d",this.getDate());a=a.replace("MM",(this.getMonth()+1).padLeft(2));a=a.replace("M",this.getMonth()+1);a=a.replace("yyyy",this.getFullYear());a=a.replace("yy",this.getFullYear().toString().substring(2));a=a.replace("y",this.getFullYear().toString().substring(2));a=a.replace("hh",(this.getHours()%12).padLeft(2));a=a.replace("h",(this.getHours()%12));a=a.replace("HH",this.getHours().padLeft(2));a=a.replace("H",this.getHours());a=a.replace("mm",this.getMinutes().padLeft(2));a=a.replace("m",this.getMinutes());a=a.replace("ss",this.getSeconds().padLeft(2));a=a.replace("s",this.getSeconds());return a};Date.prototype.toShortDateString=function(){return this.toCustomString("dd-MM-yyyy")};Date.prototype.toShortTimeString=function(){return this.toCustomString("HH:mm")};Date.prototype.toGeneralString=function(){return this.toCustomString("d-M-yyyy")+" "+this.toCustomString("H:mm")};String.prototype.format=function(){var b=this;var a=0;while(b.indexOf("{"+a+"}")>=0){if(a<arguments.length){b=b.replace("{"+a+"}",arguments[a])}else{break}a++}return b};Array.prototype.indexOf=function(b,c){var a;if(!c){c=0}for(a=c;a<this.length;a++){if(this[a]==b){return a}}return -1};(function(){var b=this,c,d=b.skwas,a=b.skwas=function(e){return new a.fn.init(e)};a.fn=a.prototype={};a.utils=b.skwas.utils={debug:location.host.indexOf(".")==-1,fromAjaxDate:function(e){if(e){if(typeof e=="string"){var f=parseInt(e.match(/.*\((\d*)\)/)[1]);var g=new Date(f);return g}return e}},ajax:function(f,e,h,g){$.ajax({type:"POST",url:f,data:e?$.toJSON(e):null,contentType:"application/json; charset=utf-8",dataType:"json",success:h,complete:function(j){switch(j.status){case 500:var i=$.evalJSON(j.responseText);alert(i.Message+(a.utils.debug?"\r\n\r\n"+i.StackTrace:""));break;case 404:alert("Service url not found:\r\n\r\n"+f);break;case 200:break;default:alert($.evalJSON(j.responseText).Message);break}if(g){g(j)}}})},clone:function(e){if(e==null){return null}return $.secureEvalJSON($.toJSON(e))},random:function(e,f){if(!f){f=1}return f+Math.floor((e-f+1)*Math.random())},loadScript:function(g,j,i){var h=document.getElementsByTagName("head")[0];var f=document.createElement("script");f.src=g;var e=false;f.onload=f.onreadystatechange=function(){if(!e&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){e=true;f.onload=f.onreadystatechange=null;if(i){h.removeChild(f)}if(j){j()}}};h.appendChild(f)},loadStyleSheet:function(f,i){var g=document.getElementsByTagName("head")[0];var h=document.createElement("link");h.href=f;h.rel="stylesheet";h.type="text/css";var e=false;h.onload=h.onreadystatechange=function(){if(!e&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){e=true;h.onload=h.onreadystatechange=null;if(i){i()}}};g.appendChild(h)},createPreloadImage:function(g,h){var f=document.createElement("img");f.src=g;var e=false;f.onload=f.onreadystatechange=function(){if(!e&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){e=true;f.onload=f.onreadystatechange=null;if(h){h()}}};return $(f)},htmlDecode:function(e){var f=document.createElement("div");f.innerHTML=e;return f.textContent?f.textContent:f.innerText},htmlEncode:function(e){var f=document.createElement("div");if(f.textContent){f.textContent=e}else{f.innerText=e}return f.innerHTML},validate:function(g){if((g==c)||(g==null)){g=$("body")}var f=$(".required",g);var e=false;function h(){e=true;var i=true;f.filter(":text:visible.required,textarea:visible.required").each(function(){if($(this).val()==""){$(this).addClass("field-invalid");i=false}else{$(this).removeClass("field-invalid")}});f.filter(":checkbox:visible.required").each(function(){if(!$(this).checked()){$(this).addClass("field-invalid");i=false}else{$(this).removeClass("field-invalid")}});return i}f.filter(":text:visible.required,textarea:visible.required").bind("blur",function(){if(e){h()}});return h()}}})();(function(){skwas.changeTracker=function(a,b){return new skwas.changeTracker.fn.init(a,b)};skwas.changeTracker.fn=skwas.changeTracker.prototype={_form:null,_inputSelector:".editable input, .editable textarea, .editable select",init:function(c,f){this._form=c;var b=this;if(f){this._inputSelector=f}function d(){var g=true;if(typeof Page_ClientValidate==="function"){g=Page_ClientValidate()}return g}function a(){return d()&&!b._form.find(":submit:last").attr("disabled")}function e(g){if(a()===true){_checkForPageExit=false;if(g==undefined){b._form.find(":submit:last").click()}return true}else{return false}}$("a[rel=save]").click(function(){if(a()===true){e()}return false});c.bind("submit",e);window.onbeforeunload=function(){if(window._checkForPageExit!=undefined){if(!window._checkForPageExit){return}}if(b.isChanged()){return"Alle wijzigingen die u heeft aangebracht nadat u de laatste keer hebt opgeslagen, gaan verloren."}}},_getValue:function(b){var a;switch(b.attr("type")){case"radio":case"checkbox":a=b.attr("checked");break;default:if(b.hasClass("watermark")){return""}else{a=b.val()}break}return a},_setValue:function(b,a){switch(b.attr("type")){case"radio":case"checkbox":b.attr("checked",a);return;default:b.val(a);return}},saveCurrentState:function(a){var b=this;if(a==undefined){a=this._form}$(this._inputSelector,$(a)).filter(":not(:password)").each(function(){$(this).data("initial_value",b._getValue($(this)))});return true},isChanged:function(a){var b=this;var c=false;if(a==undefined){a=this._form}$(this._inputSelector,$(a)).filter(":not(:password)").each(function(){if(b._getValue($(this))!=$(this).data("initial_value")){c=true;return false}});return c},reset:function(a){var b=this;if(a==undefined){a=this._form}$(this._inputSelector,$(a)).filter(":not(:password)").each(function(){b._setValue($(this),$(this).data("initial_value"))})}};skwas.changeTracker.fn.init.prototype=skwas.changeTracker.fn})();(function(){skwas.formProgressIndicator=function(a){return new skwas.formProgressIndicator.fn.init(a)};skwas.formProgressIndicator.fn=skwas.formProgressIndicator.prototype={_indicators:null,_delayTimer:null,delay:200,init:function(a){this._indicators=a},hide:function(){if(this._delayTimer){clearTimeout(this._delayTimer)}this._delayTimer=null;var a=this._indicators;if(typeof a==="string"){a=$(a)}a.css("display","").parent().attr("disabled",false)},show:function(a){var b=this;this.hide();var c=this._indicators;if(typeof c==="string"){c=$(c)}this._delayTimer=setTimeout(function(){c.each(function(){var d=$(this);var e=d.parent();if(a&&!$.contains(e[0],a[0])){return}d.css("height",e.height()+"px").css("display","block").focus().children("div").each(function(){$(this).css("left",(e.width()-$(this).width())/2+"px").css("top",(e.height()-$(this).height())/2+"px")});e.attr("disabled",true)})},this.delay)}};skwas.formProgressIndicator.fn.init.prototype=skwas.formProgressIndicator.fn})();
