Function.prototype.bind=function(obj){var method=this,temp=function(){return method.apply(obj,arguments)};return temp};(function($){var _readyQueue=[],_behaviors=[],_class={list:{},create:function(){return function(){this.initialize.apply(this,arguments)}}},_System=function(){};var _msiebuttonexp=/^[\s\S]*<!--\[msiebutton\](.*)-->$/g;Object.extend=function(tgt,src){for(property in src)tgt[property]=src[property];return tgt};_class.Inherit=function(base,args){var o=_class.create();o.prototype=Object.extend(base,args);return o};_System.prototype._Sys=_class.create();_System.prototype._Sys.prototype={initialize:function(){},create:function(){},exec:function(type,name,options,params){var o={scfRequest:{type:type,name:name,args:params}};var result=null;var data=$.scf.json.toString(o);var x=$.scf.json.post(Object.extend({async:true,error:function(x){alert(x.statusText)},url:document.location.href,data:data,callback:function(obj){if(obj.errorMessage!=null)alert(obj.errorMessage);else if(typeof options.callback=='function')options.callback(obj.result);else if(!options||options.async)alert("Result: "+obj.result)}},options))},startTranslate:function(name,callback,params){return this.exec("execTrans",name,{callback:function(o){if(o.errorMessage)throw new Error($.scf.smartlet.ERR_BASE+2,$.scf.settings.strings.serverThrewException+": "+obj.errorMessage);else callback(o.result)},async:true},params)},translate:function(name,params){var r=null;this.exec("execTrans",name,{callback:function(o){if(o.errorMessage)throw new Error($.scf.smartlet.ERR_BASE+2,$.scf.settings.strings.serverThrewException+": "+obj.errorMessage);else r=o.result},async:false},params);return r}};_System.prototype._Behavior=_class.create();_System.prototype._Behavior.prototype={initialize:function(){},create:function(interface,base){return _class.Inherit(base||new BehaviorBase(),interface)},ready:function(fn){_readyQueue.push(function(){return fn.call(this)})},add:function(cls,interface,base){eval('_class.list.'+cls+'=this.create(interface, base)');_behaviors[cls]=eval('new _class.list.'+cls+"(cls)");_behaviors[cls].name=cls;if(interface.autoAttach)this.attach(interface.autoAttach,cls)},get:function(name){return _behaviors[name]},attach:function(sel,name,settings){if(!name){name=sel;sel="."+name}this.ready(function(){$(sel).scf_behavior(name,settings)})},start:function(){for(var i=0;i<_readyQueue.length;i++)_readyQueue[i].call()}};var _sys=new _System();_sys.Class=_class;function BehaviorBase(){};BehaviorBase.prototype={state:{},initialize:function(){},autoAttach:null,attach:function(el,settings,jq,instance){},detach:function(el){}};_System.prototype.StringBuilder=_class.create();_System.prototype.StringBuilder.prototype={initialize:function(text){this.length=0;this._index=0;this._ar=[];this._cache=null;if(text!=null)this.append(text)},add:function(text){this.length+=(this._ar[this._index++]=String(text)).length;this._cache=null;return this},addLine:function(s){this.add(s);this.add("\n")},toString:function(){if(this._cache!=null)return this._cache;return this._cache=this._ar.join("")}};_System.prototype.JSONFilter=_class.create();_System.prototype.JSONFilter.prototype={state:{},initialize:function(p){state=this;state.prop=p},filter:function(n,v){if(n.substring(0,1)=='_')return null;else if(state.prop[n]){if($.scf.smartlet._getA(state.prop[n],true)<2&&$.scf.smartlet._getA(state.prop[n],false)==2){v["v"]=null}}return v}};_System.prototype._Smartlet=_class.create();_System.prototype._Smartlet.prototype={initialize:function(sys){_this=this;_sys=sys},ERR_BASE:1899000,_err:function(obj,n,msg){throw new Error(this.ERR_BASE+n,msg+"\r\rSmarlet: "+obj.sml);},_check:function(obj,name){if(typeof(obj.prop[name])=='undefined')_this._err(obj,5,"Property '"+name+"' not defined.")},_getA:function(prop,client){var a=prop.a,ix=client?0:1;if(a&&a.indexOf('.')!=-1)return parseInt(a.split('.')[ix]);return 0},_enrich:function(obj){obj=Object.extend(obj||{},{prop:obj.prop||[],id:function(s){return this.nm+((s)?"_"+s:"")},name:function(s){return this.sml+((s)?"_"+s:"")},_priv:{reuseAjax:true},abort:function(){if(obj._priv.x)obj._priv.x.abort();if(obj._priv.busy)$(obj._priv.busy).scf_busy(0)},ajax:function(cb){return $.scf.smartlet._ajax(obj,cb)},get:function(name){$.scf.smartlet._check(obj,name);var v=obj.prop[name].v;var p=obj.prop[name];if(p.t==64&&typeof(v)=='string')v=$.scf.convert.date.parseXmlDate(v);if(p.e)v=$.scf.convert.base64.decode(v.toString());return v},set:function(name,value){if(typeof(obj.prop[name])=='undefined')_this._err(obj,9,"Property '"+name+"' is not defined.");var p=obj.prop[name];if($.scf.smartlet._getA(p,true)<2)_this._err(obj,8,"Property '"+name+"' is not writable on the client.");if(p.e)value=$.scf.convert.base64.encode(value.toString());$.scf.smartlet._check(obj,name);obj.prop[name].v=value},trigger:function(name,data){var evName=$.scf.smartlet._getEvtName(obj,null,name);var e=$.Event(evName);e.args=data;e.smartlet=obj;$(document).trigger(e);return e.result}});return obj},_update:function(obj){var sml=window.smartlet[obj.nm];for(e in obj.prop){if(typeof(obj.prop[e].v)!='undefined')if(sml.prop[e]){sml.prop[e].v=obj.prop[e].v}}},add:function(id,settings){if(!window.smartlet)window.smartlet=[];var sml=this._enrich(settings);window.smartlet[id]=sml},_getEvtName:function(srcSml,evtName,custEvt,propName){if(custEvt){if(custEvt.indexOf('_')==-1)return srcSml.sml+"_"+custEvt;else return custEvt}else return srcSml.nm+"_"+propName+"_"+evtName},bind:function(options,handler){if(typeof(options)=='object'&&typeof(handler)=='undefined'){if(options.source!=null){var e;var srcSml=this.get(options.source);if(srcSml)e=this._getEvtName(srcSml,options.event,options.customEvent,options.sourceProperty)}else e=options.customEvent;var destSml=this.get(options.destination);if(destSml&&typeof(destSml['dispatch'])=='function')$.scf.smartlet.bind(e,destSml['dispatch'])}else if(handler)$(document).bind(options,handler)},behavior:{create:function(){return $.scf.behavior.create({test:function(){}},new BehaviorBase())}},get:function(id){if(id&&id.id)id=id.id;else if(id&&typeof(id.attr)=='function')id=id.attr('id');if(!window.smartlet)window.smartlet=[];return window.smartlet[id]},debug:function(writer){window.debugWriter=writer},_ajax:function(smartlet,c,options){options=(!options&&typeof(c)=='function')?{ready:c}:c||{};if(options.abortPrevious)smartlet.abort();if(typeof(options.start)=='function')options.start();if(options.currentProperty)smartlet.currentProperty=options.currentProperty;if(options.event){smartlet.event={eventName:options.event.type,data:options.event.args}}else smartlet.event=null;var u=smartlet.url;if(options.query)u+=((u.indexOf('?')!=-1)?'&':'?')+options.query;if(typeof(options.busy)!='undefined'){if(typeof(options.busy)=='function'){options.busy();smartlet._priv.busy=c.busy}else if(options.busy==true||typeof(options.busy)=='string'||typeof(options.busy)=='object'){smartlet._priv.busy='#'+smartlet.id();var settings={value:true};if(typeof(options.busy)=='string'||typeof(options.busy)=='object'){var s="";if(typeof(options.busy)=='object'){if(options.busy.documentElement||options.busy.domManip)smartlet._priv.busy=$(options.busy);else{settings=options.busy}}}el=smartlet._priv.busy;$(el).scf_busy(settings)}}options.ready=options.ready||function(x){};var ajOpts={url:u,data:$.scf.json.toString(smartlet,null,new _System.prototype.JSONFilter(smartlet.prop).filter),callback:function(j){try{if(smartlet._priv.busy){if(typeof(smartlet._priv.busy)=='function')smartlet._priv.busy(false);else{$(smartlet._priv.busy).scf_busy(false)}smartlet._priv.busy=null}}catch(ex){};if(j.evt!=null){for(var e in j.evt)smartlet.trigger(e,j.evt[e]);j.evt=null};Object.extend(window.smartlet[j.nm].prop,j.prop);options.ready(j)},isSmartlet:true};if(options.event&&options.event.smartlet&&options.event.smartlet._priv)options.event.smartlet._priv.x=null;var opts=Object.extend(ajOpts,options||{});var x=$.scf.json.post(opts,smartlet);if(smartlet._priv.reuseAjax)smartlet._priv.x=x;return x}};_sys.JSON=function(){function f(n){return n<10?'0'+n:n}Date.prototype.toJSON=function(){var s=this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z';return s};var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','/':'\\/','"':'\\"','\\':'\\\\'};function stringify(value,whitelist,callback){var a,i,k,l,v,r=/["\\\x00-\x1f\x7f-\x9f]/g;switch(typeof value){case'string':return r.test(value)?'"'+value.replace(r,function(a){var c=m[a];if(c)return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"':'"'+value+'"';case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value)return'null';if(typeof value.toJSON==='function')return stringify(value.toJSON(),null,callback);a=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){l=value.length;for(i=0;i<l;i+=1){a.push(stringify(value[i],whitelist,callback)||'null')};return'['+a.join(',')+']'}if(whitelist){l=whitelist.length;for(i=0;i<l;i+=1){k=whitelist[i];if(typeof k==='string')v=stringify(value[k],whitelist,callback);if(v)a.push(stringify(k,null,callback)+':'+v)}}else{for(k in value){v=null;if(typeof k==='string'){if(callback){v=callback(k,value[k]);if(v!=null)v=stringify(v,whitelist,callback)}else{v=stringify(value[k],whitelist,callback)}if(v!=null)a.push(stringify(k,null,callback)+':'+v)}}}return'{'+a.join(',')+'}'}}return{stringify:stringify,parse:function(text,filter){var j;function walk(k,v){var i,n;if(v&&typeof v==='object'){for(i in v){if(Object.prototype.hasOwnProperty.apply(v,[i])){n=walk(i,v[i]);if(n!==undefined)v[i]=n}}}return filter(k,v)}if(/^[\],:{}\s]*$/.test(text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof filter==='function'?walk('',j):j}throw new Error('JSON parse error.');}}}();$.extend({scf:{sys:new _sys._Sys(),behavior:new _sys._Behavior(),smartlet:new _sys._Smartlet(_sys),convert:{date:{parseXmlDate:function(s){var match=s.match(/^([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})T(?:([0-2][0-9]):([0-5][0-9]):([0-5][0-9])Z?)?$/);if(match){var d=new Date(RegExp.$1,parseInt(RegExp.$2)-1,RegExp.$3,RegExp.$4,RegExp.$5,RegExp.$6);return d}else _this._err(obj,14,$.scf.settings.strings.invalidDate+": "+s)},parse:function(s){var splitter='/';if($.scf.settings.locale==1043){if(s.indexOf(splitter)==-1)splitter='-';var p=s.split(splitter);if(p.length==3)s=p[1]+"/"+p[0]+"/"+p[2]}var v=Date.parse(s);v=new Date(v);return v}},base64:{charmap:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(str){var ret=new $.scf.string.build();var c,i,acc=0;var div=1;for(i=0,c=0;i<str.length;i++,c++){acc=acc*256+str.charCodeAt(i);div=div*4;ret.add(this.charmap.charAt(parseInt(acc/div)));acc=acc%div;if(div==64){ret.add(this.charmap.charAt(parseInt(acc)));acc=0;div=1;c++}if(c>=75){c=-1;ret.add("\n")}}if(i%3){ret.add(this.charmap.charAt(parseInt(acc*((i%3==1)?16:4))));ret.add(((i%3)==1?"==":"="))}return ret.toString()},decode:function(str){var ret=new $.scf.string.build();var i,acc=0;var div=1;for(i=0;i<str.length;i++){if(str.charAt(i)=="="||str.charAt(i)=='\n')break;acc=acc*64+this.charmap.indexOf(str.charAt(i));div=(div==1?64:div/4);if(div!=64){ret.add(String.fromCharCode(parseInt(acc/div)));acc=acc%div}}return ret.toString()}}},string:{build:_sys.StringBuilder},json:{toString:function(a,b,c){return _sys.JSON.stringify(a,b,c)},parse:function(data,reviver){return _sys.JSON.parse(data,reviver)},post:function(options,smartlet){var ajOpts={dataType:"text",type:"POST",url:options.url,data:options.data,contentType:"application/json",success:function(x){try{if(x.length==0)return;obj=eval('('+x+')');if(window.smartlet&&options.isSmartlet)obj=$.scf.smartlet._enrich(obj)}catch(ex){var exdata='';for(e in ex)exdata+='\r\n'+e+' = '+ex[e];throw new Error($.scf.smartlet.ERR_BASE+1,"Invalid response JSON: \r\n"+exdata);}if(obj.lastError){var ab=function(){if(smartlet&&smartlet._priv.busy)$(smartlet._priv.busy).scf_busy(0);else if(obj.abort)obj.abort()};var er=new Error($.scf.smartlet.ERR_BASE+2,$.scf.settings.strings.serverThrewException+": "+obj.lastError);er.errorType=obj.lastErrorType;if(window.smartlet&&options.isSmartlet){if(obj.errorCaught==true)$.scf.smartlet._update(obj)};if(typeof(options.error)=='function'){options.error(obj);ab()}else if(obj.errorCaught==true){alert(obj.lastErrorMessage||obj.lastError);ab()}else{ab();throw er;}}else{if(window.smartlet&&options.isSmartlet)$.scf.smartlet._update(obj);if(options&&typeof options.callback=='function')options.callback(obj)}}};return $.ajax(Object.extend(ajOpts,options||{}))}},ready:function(fn){this.behavior.ready(fn)},start:function(settings){$.scf.settings=settings||{};$.scf.settings.strings=Object.extend($.scf.settings.strings||{},{busyWorking:$.scf.settings.locale==1043?"Bezig":"Working",invalidDate:$.scf.settings.locale==1043?"Ongeldige datum":"Invalid date",serverThrewException:$.scf.settings.locale==1043?"De server heeft een uitzondering geretourneerd":"The server threw an exception",close:$.scf.settings.locale==1043?"Sluiten":"Close"});$("body").addClass("scf-script-enabled");if($.scf.settings.conflict)jQuery.noConflict();document.cookie='_sce=1';this.behavior.start();if(typeof(settings.callback)=="function")settings.callback()}}});$.extend({_ns:{cur:null,init:$.fn.init,obj:{},extend:function(ns){if(eval(ns)!=undefined){$.extend(eval(ns),{})}else{eval(ns+" = {};")}}},namespace:function(namespaces,objects){if(typeof objects=="function"){if(namespaces.match(".")){var a=namespaces.split("."),d="";for(var i=0;i<a.length;i++){d+="['"+a[i]+"']";$._ns.extend("$._ns.obj"+d);$._ns.extend("$.fn"+d)}eval("$._ns.obj"+d+" = objects;");eval("$.fn"+d+" = "+"function(){ return eval(\"$._ns.obj"+d+".apply($._ns.cur, arguments)\"); }")}else{$.extend({namespaces:function(){return objects($.fn._ns.cur)}})}}else{for(var space in objects){$.namespace(namespaces+"."+space,objects[space])}}}});$.fn.extend({init:function(selector,context){$._ns.cur=new $._ns.init(selector,context);return $._ns.cur}});$.fn.scf_behavior=function(name,options){if(typeof name=='function'){$.scf.behavior.guid=$.scf.behavior.guid||0;$.scf.behavior.guid++;var guid="anonymousBehavior_"+$.scf.behavior.guid;$.scf.behavior.add(guid,{attach:name});name=guid}return this.each(function(){var el=$(this);var o=$.scf.behavior.get(name);if(!o)throw new Error("Behavior not defined: "+name);var e=el.get(0);e.behavior=o;o.attach.apply(el,[e,options||{},el])})};$.fn.scf_moveOver=function(el,align){align=align||'center';var p=el.offset(),x=p.left,y=p.top;return this.each(function(){var t=$(this);if(align=='right'){x-=(t.outerWidth()-el.outerWidth());y-=(t.outerHeight()-el.outerHeight())}else if(align=='center'){x-=t.outerWidth()/2-el.outerWidth()/2;y-=t.outerHeight()/2-el.outerHeight()/2}t.css({position:'absolute',zIndex:5000,top:y,left:x})})};$.fn.scf_busy=function(ok,text){if(typeof(ok)=='undefined')ok=true;var settings={delay:1000,fadeInTime:100,fadeOutTime:200,value:typeof(ok)=='undefined'?true:(typeof(ok)=='object'?true:ok)};if(typeof(ok)=='object')settings=Object.extend(settings,ok);return this.each(function(){var el=$(this),e=el.get(0);if(e._btmr){clearTimeout(e._btmr);e._btmr=null}if(settings.value){var show=function(){if(e.busyDiv)e.busyDiv.remove();if(settings.delay>0&&!e._btmr)return;e.busyDiv=$("<div></div>");e.busyDiv.text(text||$.scf.settings.strings.busyWorking).addClass("ScfAjaxBusySmall").hide().mousedown(function(){$(this).remove()});el.parent().append(e.busyDiv);e.busyDiv.scf_moveOver(el);if(settings.fadeInTime>0)e.busyDiv.fadeIn(settings.fadeInTime);else e.busyDiv.show()};if(settings.delay>0)e._btmr=setTimeout(show,settings.delay);else show()}else{if(e.busyDiv){if(settings.value==false)$(e.busyDiv).fadeOut(settings.fadeOutTime,function(){$(e.busyDiv).remove();e.busyDiv=null});else{$(e.busyDiv).remove();e.busyDiv=null}}}})};$.fn.scf_form={toJSON:function(){var f=this[0];if(!f||f.tagName!='FORM'||typeof f.getData!='function')throw new Error("Not a valid Scf form");var data=f.getData();return $.scf.json.toString(data)},val:function(){var el=this[0];var v=$(el).val();if(typeof v=="string")v=v.replace(_msiebuttonexp,"$1");return v}};$.fn.scf_popup=function(options){if(options==false)$(".ScfPopup").fadeOut(300,function(){$(this).remove()});else{options=options||{};options.inEffectTime=options.inEffectTime||300;options.outEffectTime=options.outEffectTime||300;options.css=options.css||{};function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()}};var toolbar="<img title='"+$.scf.settings.strings.close+"' alt='' class='CmdClosePopup' src='/scf/gfx/close.png'/>";return this.each(function(){var j=$(this),e=j.get(0);e.scfPop=$("<table class='ScfPopup'><thead><tr><th class='Title'>"+(options.title||"Popup")+"</th><th class='ToolBar'>"+toolbar+"</th><thead></tr><tbody><tr><td colspan='2' class='ScfPopupBody ScfAjaxBusy'>"+(options.loadingText||$.scf.settings.strings.busyWorking)+"</td></tr></tbody></table>");var o=j.offset();var pj=$(e.scfPop);pj.css({left:o.left+20,top:o.top+20}).css(options.css).hide();j.addClass("PopupShown");$(document.body).append(e.scfPop);pj.fadeIn(options.inEffectTime,function(){options.html=options.html||"No data";var popBody=$('tbody td:first-child',e.scfPop);var v=viewport(),os=pj.offset();if(v.x+v.cx<os.left+pj.width())pj.animate({left:(v.x+v.cx-pj.width()-20)+'px'},200);if(v.y+v.cy<os.top+pj.height())pj.animate({top:(v.y+v.cy-pj.height()-20)+'px'},200);var ready=function(data){if(data)options.html=data;popBody.removeClass("ScfAjaxBusy").html(options.html)};if(typeof(options.load)=='function')options.load(ready);else ready();$(".CmdClosePopup",e.scfPop).hover(function(){$(this).animate({width:"20px"},100)},function(){$(this).animate({width:"16px"},50)}).click(function(){$(e.scfPop).fadeOut(options.outEffectTime,function(){$(e.scfPop).remove()})})});return false})}};$.namespace("scf",{behavior:$.fn.scf_behavior,popup:$.fn.scf_popup,busy:$.fn.scf_busy,moveOver:$.fn.scf_moveOver});$.namespace("scf.form",{val:$.fn.scf_form.val,toJSON:$.fn.scf_form.toJSON})})(jQuery);var $j=jQuery;
