/*
 * application
 * Copyright(c) 2006, Synetic BV.
 */


var PR={aLabels:{},aLanguages:{},iApplicationInstanceId:new Date().getTime(),oApplicationNamespace:null,notifyContainer:null,ready:false,getLabel:function(sLabel,bSingular,aValues)
{if(PR.isEmpty(this.aLabels[sLabel.toLowerCase()]))
{$.get(LINK_ROOT+"/variable/getLabel",{label:sLabel,plural:(!PR.isEmpty(bSingular)?bSingular:false)});}
else
{if(!PR.isEmpty(bSingular)&&bSingular==false&&!PR.isEmpty(this.aLabels[sLabel.toLowerCase()].plural))
{sLabel=this.aLabels[sLabel.toLowerCase()].plural;}
else if(!PR.isEmpty(this.aLabels[sLabel.toLowerCase()].singular))
{sLabel=this.aLabels[sLabel.toLowerCase()].singular;}}
if(!PR.isEmpty(aValues))
{for(key in aValues)
{sLabel=sLabel.replace('['+key+']',aValues[key]);}}
return sLabel;},fetchLabelsFromServer:function(aParams)
{$.get(LINK_ROOT+"/variable/getLabels",function(aLabels)
{this.aLabels=aLabels;if(!PR.isEmpty(aParams)&&!PR.isEmpty(aParams.success))
{aParams.success();}}.bind(this));},run:function(oApplicationNamespace)
{this.oApplicationNamespace=oApplicationNamespace;$.ajaxSetup({beforeSend:function(oXMLHttpRequest)
{oXMLHttpRequest.setRequestHeader('X-Request-Type','Ajax');}});if(!PR.isEmpty(this.oApplicationNamespace)&&!PR.isEmpty(this.oApplicationNamespace.run))
{this.oApplicationNamespace.run.call(this.oApplicationNamespace);}
else
{this.ready=true;}},onReady:function(fn)
{if(this.ready==false)
{PR.onReady.defer(100,this,[fn]);}
else
{fn();}},debug:function()
{if(typeof(console)!='undefined'&&typeof(console.log)!='undefined')
{console.log(arguments[0]);}
else if(typeof(parent.console)!='undefined'&&typeof(parent.console.log)!='undefined')
{parent.console.log.apply(parent.console,arguments);}
else
{if(typeof Ext!='undefined'&&typeof Ext.DomHelper!='undefined')
{PR.notify('debug',Array.prototype.slice.call(arguments).toString());}
else
{window.alert(Array.prototype.slice.call(arguments).toString());}}
return;},notify:function(sTitle,sText,sClass,iSecondsPause)
{if(this.notifyContainer==null)
{this.notifyContainer=Ext.DomHelper.append(document.body,{id:'pr_notify'},true);}
var m=Ext.DomHelper.append(this.notifyContainer,{html:'<div class="outer '+(typeof sClass!='undefined'?sClass:'')+'">'+'<div class="inner">'+'<h3>'+sTitle+'</h3>'+'<div class="text">'+sText+'</div>'+'</div>'+'</div>'},true);m.slideIn('t').pause((!Ext.isEmpty(iSecondsPause)?iSecondsPause:4)).ghost("t",{remove:true});},isObjectEmpty:function(obj)
{for(var o in obj)
{return false;}
return true;},isEmpty:function(mVariable)
{try
{if(typeof mVariable=='undefined'||mVariable===null||mVariable===""||(typeof(mVariable)=='object'&&PR.isObjectEmpty(mVariable))||(typeof mVariable!='function'&&typeof mVariable.length!='undefined'&&mVariable.length==0))
{return true;}
else
{return false;}}
catch(e)
{return false;}},callFunctionByName:function(sFunctionName,aArgs)
{var aNamespaces=sFunctionName.split(".");var sFunction=aNamespaces.pop();var oContext=window;for(var i=0;i<aNamespaces.length;i++)
{oContext=oContext[aNamespaces[i]];}
if(!PR.isEmpty(oContext[sFunction]))
{return oContext[sFunction].apply(oContext,!PR.isEmpty(aArgs)?aArgs:[]);}
return null;}};Function.prototype.bind=function()
{var fn=this,args=Array.prototype.slice.call(arguments),object=args.shift();return function()
{return fn.apply(object,args.concat(Array.prototype.slice.call(arguments)));};};

PR.oPageTracker=null;PR.sGoogleTrackingUA=null;PR.HEADER_WITH_MENU=1;PR.HEADER_WITHOUT_MENU=2;PR.bBackGroundIsAnimating=false;PR.aBackgroundPositions=[{left:0,top:0},{left:500,top:500},{left:2500,top:1000}];PR.iCurrentBackGroundPosition=0;PR.bIsStartupLoad=true;PR.iAttempts=120;PR.useHashNavigation=false;PR.oHtml={};PR.navigateToUrl=function(sUrl,bIsRetry)
{if((sUrl==''||new PR.Url(window.location.href.replace(LINK_ROOT,'')).setHash('')==sUrl)&&PR.bIsStartupLoad==true)
{PR.bIsStartupLoad=false;return false;}
if(sUrl=='')
{sUrl=window.location.toString().replace(LINK_ROOT,'');}
if(sUrl=='')
{sUrl='/';}
PR.oHtml='';var iAttemptsRemaining=PR.iAttempts;sUrl=LINK_ROOT+sUrl;PR.ready=false;function setContent()
{if(PR.isEmpty(PR.oHtml)&&iAttemptsRemaining>0)
{iAttemptsRemaining--;setTimeout(setContent,250);return;}
PR.Website.removeClasses();if(PR.oHtml.header_type==PR.HEADER_WITHOUT_MENU)
{$('#header').hide();$('#header-nomenu').show();}
else
{$('#header').show();$('#header-nomenu').hide();}
$('#body-content').html(PR.oHtml.html);if(typeof PR.oHtml.title!='undefined')
{document.title=PR.oHtml.title;}
if(!PR.isEmpty(PR.oPageTracker))
{PR.oPageTracker._trackPageview(!PR.isEmpty(PR.oHtml.tracking_url)?PR.oHtml.tracking_url.replace(LINK_ROOT,''):sUrl.toString().replace(LINK_ROOT,''));}
PR.Form.InputTip.addTips();$("#body-content a[rel^='prettyPhoto']").prettyPhoto();$('#body-content .tooltip[title!=""]').tooltip();PR.oHtml={};PR.ready=true;}
$.ajax({url:sUrl,success:function(aData)
{PR.oHtml=aData;},error:function(oXMLHttpRequest,sTextStatus,sErrorThrown)
{},beforeSend:function(oXMLHttpRequest)
{oXMLHttpRequest.setRequestHeader('X-Request-Type','Ajax');oXMLHttpRequest.setRequestHeader('X-Display-Header','false');},dataType:'json'});if(PR.bBackGroundIsAnimating!=true)
{var iCorrection=$(window).height()-
$('#header').height()-parseInt($('#header').css('padding-top'))-
$('#footer').height()-parseInt($('#footer').css('padding-top'));$('#body-content').html('<div style="height: '+(iCorrection)+'px;">&nbsp;</div>');PR.bBackGroundIsAnimating=true;if(PR.bIsStartupLoad!=true)
{var iCurrentBackGroundPosition=PR.iCurrentBackGroundPosition;while(iCurrentBackGroundPosition==PR.iCurrentBackGroundPosition)
{iCurrentBackGroundPosition=parseInt(Math.random()*PR.aBackgroundPositions.length);}
PR.iCurrentBackGroundPosition=iCurrentBackGroundPosition;var aPosition=PR.aBackgroundPositions[iCurrentBackGroundPosition];var iMaxLeft=$("#background .inner img").width()-$(window).width();var iMaxTop=$("#background .inner img").height()-$(window).height();if(aPosition.left>iMaxLeft)aPosition.left=iMaxLeft;if(aPosition.top>iMaxTop)aPosition.top=iMaxTop;$("#background .inner img").animate({left:aPosition.left*-1,top:aPosition.top*-1},1500,"easeInOutQuad",function()
{PR.bBackGroundIsAnimating=false;setContent();});}
else
{PR.bBackGroundIsAnimating=false;PR.bIsStartupLoad=false;setContent();}}
else
{setContent();}};PR.navigateTo=function(oLink)
{if(oLink.href)
{$.historyLoad(oLink.href.toString().replace(LINK_ROOT,''));}
else
{$.historyLoad(oLink.replace(LINK_ROOT,''));}
return false;};

if(typeof Ext=='undefined')
{var Ext={apply:function(o,c,defaults)
{if(defaults){Ext.apply(o,defaults);}
if(o&&c&&typeof c=='object'){for(var p in c){o[p]=c[p];}}
return o;},applyIf:function(o,c)
{if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p];}}}
return o;},extend:function()
{var io=function(o){for(var m in o){this[m]=o[m];}};var oc=Object.prototype.constructor;return function(sb,sp,overrides){if(typeof sp=='object'){overrides=sp;sp=sb;sb=overrides.constructor!=oc?overrides.constructor:function(){sp.apply(this,arguments);};}
var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==oc){spp.constructor=sp;}
sb.override=function(o){Ext.override(sb,o);};sbp.override=io;Ext.override(sb,overrides);sb.extend=function(o){Ext.extend(sb,o);};return sb;};}(),override:function(origclass,overrides){if(overrides){var p=origclass.prototype;for(var method in overrides){p[method]=overrides[method];}
if(Ext.isIE&&overrides.toString!=origclass.toString){p.toString=overrides.toString;}}},util:{}};Ext.util.Observable=function()
{if(this.listeners)
{this.on(this.listeners);delete this.listeners;}};Ext.util.Observable.prototype={fireEvent:function()
{var ce=this.events[arguments[0].toLowerCase()];if(typeof ce=="object")
{return ce.fire.apply(ce,Array.prototype.slice.call(arguments,1));}
else
{return true;}},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(eventName,fn,scope,o)
{if(typeof eventName=="object")
{o=eventName;for(var e in o)
{if(this.filterOptRe.test(e))
{continue;}
if(typeof o[e]=="function")
{this.addListener(e,o[e],o.scope,o);}
else
{this.addListener(e,o[e].fn,o[e].scope,o[e]);}}
return;}
o=(!o||typeof o=="boolean")?{}:o;eventName=eventName.toLowerCase();var ce=this.events[eventName]||true;if(typeof ce=="boolean")
{ce=new Ext.util.Event(this,eventName);this.events[eventName]=ce;}
ce.addListener(fn,scope,o);},removeListener:function(eventName,fn,scope)
{var ce=this.events[eventName.toLowerCase()];if(typeof ce=="object")
{ce.removeListener(fn,scope);}},purgeListeners:function()
{for(var evt in this.events)
{if(typeof this.events[evt]=="object")
{this.events[evt].clearListeners();}}},relayEvents:function(o,events)
{var createHandler=function(ename)
{return function()
{return this.fireEvent.apply(this,Ext.combine(ename,Array.prototype.slice.call(arguments,0)));};};for(var i=0,len=events.length;i<len;i++)
{var ename=events[i];if(!this.events[ename])
{this.events[ename]=true;};o.on(ename,createHandler(ename),this);}},addEvents:function(o)
{if(!this.events)
{this.events={};}
Ext.applyIf(this.events,o);},hasListener:function(eventName)
{var e=this.events[eventName];return typeof e=="object"&&e.listeners.length>0;}};Ext.util.Observable.prototype.on=Ext.util.Observable.prototype.addListener;Ext.util.Observable.prototype.un=Ext.util.Observable.prototype.removeListener;Ext.util.Observable.capture=function(o,fn,scope)
{o.fireEvent=o.fireEvent.createInterceptor(fn,scope);};Ext.util.Observable.releaseCapture=function(o)
{o.fireEvent=Ext.util.Observable.prototype.fireEvent;};(function()
{var createBuffered=function(h,o,scope)
{var task=new Ext.util.DelayedTask();return function()
{task.delay(o.buffer,h,scope,Array.prototype.slice.call(arguments,0));};};var createSingle=function(h,e,fn,scope)
{return function()
{e.removeListener(fn,scope);return h.apply(scope,arguments);};};var createDelayed=function(h,o,scope)
{return function()
{var args=Array.prototype.slice.call(arguments,0);setTimeout(function()
{h.apply(scope,args);},o.delay||10);};};Ext.util.Event=function(obj,name)
{this.name=name;this.obj=obj;this.listeners=[];};Ext.util.Event.prototype={addListener:function(fn,scope,options)
{var o=options||{};scope=scope||this.obj;if(!this.isListening(fn,scope))
{var l={fn:fn,scope:scope,options:o};var h=fn;if(o.delay)
{h=createDelayed(h,o,scope);}
if(o.single)
{h=createSingle(h,this,fn,scope);}
if(o.buffer)
{h=createBuffered(h,o,scope);}
l.fireFn=h;if(!this.firing)
{this.listeners.push(l);}
else
{this.listeners=this.listeners.slice(0);this.listeners.push(l);}}},findListener:function(fn,scope)
{scope=scope||this.obj;var ls=this.listeners;for(var i=0,len=ls.length;i<len;i++)
{var l=ls[i];if(l.fn==fn&&l.scope==scope)
{return i;}}
return-1;},isListening:function(fn,scope)
{return this.findListener(fn,scope)!=-1;},removeListener:function(fn,scope)
{var index;if((index=this.findListener(fn,scope))!=-1)
{if(!this.firing)
{this.listeners.splice(index,1);}
else
{this.listeners=this.listeners.slice(0);this.listeners.splice(index,1);}
return true;}
return false;},clearListeners:function()
{this.listeners=[];},fire:function()
{var ls=this.listeners,scope,len=ls.length;if(len>0)
{this.firing=true;var args=Array.prototype.slice.call(arguments,0);for(var i=0;i<len;i++)
{var l=ls[i];if(l.fireFn.apply(l.scope||this.obj||window,arguments)===false)
{this.firing=false;return false;}}
this.firing=false;}
return true;}};})();}

PR.Url=function(sUrl)
{if(typeof sUrl=='undefined')
{sUrl=window.location.href.toString();}
var sHash=/#.*/.test(sUrl)?sUrl.match(/#.*/)[0].toString():"";sUrl=sUrl.replace(/#.*/,'');var aHistogram={"'":'%27','(':'%28',')':'%29','*':'%2A','~':'%7E','!':'%21','%20':'+'};function getQueryStringSign()
{if(sUrl.indexOf('?')!=-1)
{return'&';}
return'?';}
this.removeParam=function(sParam)
{var oRegex=new RegExp('[&?]{1}'+sParam+'=[^&]*','g');sUrl=sUrl.replace(oRegex,'');if(/[?]/.test(sUrl)==false&&/[&]/.test(sUrl)!=false)
{sUrl=sUrl.replace(/[&]/,'?');}
return this;}
this.removeParams=function()
{var oRegex=new RegExp("(.*)\\?");var results=oRegex.exec(sUrl);sUrl=results[1];return this;}
this.addParam=function(sParam,sValue,bRemoveFirst)
{if(typeof bRemoveFirst=='undefined'||bRemoveFirst==true)
{this.removeParam(sParam);}
sUrl+=getQueryStringSign()+sParam+'='+sValue;return this;}
this.addParams=function(aParams,bRemoveFirst)
{for(key in aParams)
{this.addParam(key,aParams[key],bRemoveFirst);}
return this;}
this.getParam=function(sName)
{var oRegex=new RegExp("[\\?&]"+sName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]")+"=([^&#]*)");var results=oRegex.exec(sUrl);return results==null?"":results[1];}
this.setLink=function(sLink)
{sUrl=sLink;}
this.encode=function()
{sUrl=encodeURIComponent(sUrl);return this;}
this.decode=function()
{var unicodeStr='',hexEscStr='';for(unicodeStr in aHistogram)
{sUrl=sUrl.replace(aHistogram[unicodeStr],unicodeStr);}
sUrl=decodeURIComponent(sUrl);return this;}
this.hasHash=function()
{return!PR.isEmpty(sHash);}
this.getHash=function()
{return sHash.replace(/#/,'');}
this.setHash=function(sNewHash)
{sHash=(sNewHash!=''?'#':'')+sNewHash;return this;}
this.queryString=function(bUrlEncodeQueryString)
{var oRegex=new RegExp("\\?(.*)");var results=oRegex.exec(sUrl);if(typeof bUrlEncodeQueryString=='undefined'||bUrlEncodeQueryString==false)
{return results[1];}
else
{return encodeURIComponent(results[1]);}}
this.toString=function()
{return!PR.isEmpty(sHash)?sUrl+sHash:sUrl;}};

PR.SwfObject={aSwfObjects:{},register:function(sDomId,aParameters)
{this.aSwfObjects[sDomId]=aParameters;},embed:function(sDomId,aParameters)
{if(PR.isEmpty(aParameters)&&!PR.isEmpty(this.aSwfObjects[sDomId]))
{aParameters=this.aSwfObjects[sDomId];}
else
{this.register(sDomId,aParameters);}
if(PR.isEmpty(aParameters.minimal_version))aParameters.minimal_version={};if(PR.isEmpty(aParameters.expressinstall))aParameters.expressinstall={};if(PR.isEmpty(aParameters.flashvars))aParameters.flashvars={};if(PR.isEmpty(aParameters.params))aParameters.params={};if(PR.isEmpty(aParameters.attributes))aParameters.attributes={};swfobject.embedSWF(aParameters.src,sDomId,aParameters.width,aParameters.height,aParameters.minimal_version,aParameters.expressinstall,aParameters.flashvars,aParameters.params,aParameters.attributes);},copy:function(sOriginalMovieId,sDomId)
{if(!PR.isEmpty(this.aSwfObjects[sOriginalMovieId]))
{this.embed(sDomId,this.aSwfObjects[sOriginalMovieId]);}},get:function(sDomId)
{return this.aSwfObjects[sDomId];},getEmbedCode:function(sDomId)
{var aParameters=this.get(sDomId);var sFlashVars='';for(key in aParameters.flashvars)
{sFlashVars+='&'+key+'='+aParameters.flashvars[key].replace(/\?/g,'%3F').replace(/&/g,'%26').replace(/=/g,'%3D');}
var sHtml="<embed ";sHtml+=" src='"+aParameters.src+"'";sHtml+=" height='"+aParameters.height+"'";sHtml+=" width='"+aParameters.width+"'";sHtml+=" allowscriptaccess='"+(!PR.isEmpty(aParameters.params.allowscriptaccess)?aParameters.params.allowscriptaccess:'always')+"'";sHtml+=" allowfullscreen='"+(!PR.isEmpty(aParameters.params.allowfullscreen)?aParameters.params.allowfullscreen:'true')+"'";if(!PR.isEmpty(aParameters.params.wmode));{sHtml+=" wmode='"+aParameters.params.wmode+"'";}
sHtml+=" flashvars='"+sFlashVars.substr(1,sFlashVars.length-1)+"'";sHtml+="/>";return sHtml;}};

PR.Synchronization=function(sSyncUrl,aEvents,aOptions)
{if(PR.isEmpty(aOptions))
{aOptions={};}
aOptions=$.extend({interval:5},aOptions);function parseResponse(aUpdateEvents)
{var oScope;for(var i=0;i<aUpdateEvents.length;i++)
{if(typeof aEvents[aUpdateEvents[i].event]!='undefined')
{oScope=typeof aEvents[aUpdateEvents[i].event].scope!='undefined'?aEvents[aUpdateEvents[i].event].scope:this;aEvents[aUpdateEvents[i].event].fn.call(oScope,aUpdateEvents[i].data);}}}
this.synchronize=function(mData)
{$.ajax({url:sSyncUrl,dataType:'json',success:parseResponse,complete:function()
{setTimeout(function(){this.synchronize();}.bind(this),aOptions.interval*1000)}.bind(this),beforeSend:function(oXMLHttpRequest)
{oXMLHttpRequest.setRequestHeader('X-Request-Type','Ajax');oXMLHttpRequest.setRequestHeader('X-Response-Format','JSON');}});}
this.run=function()
{this.synchronize();}};

PR.Form={sFormDisableMode:'submit-shim-loader',aForms:[],register:function(sFormId,fOnComplete,fOnFailure,bDisableForm)
{if(typeof bDisableForm=='undefined')bDisableForm=true;this.aForms[sFormId]={id:sFormId,el:$('#'+sFormId),complete:fOnComplete,failure:fOnFailure,disableForm:bDisableForm};},setOption:function(sFormId,sOption,mValue)
{this.aForms[sFormId][sOption]=mValue;},ajaxify:function(sFormId)
{this.aForms[sFormId].el.submit(function(oEvent)
{this.submitForm(sFormId);});},submitForm:function(sFormId)
{var sUrl=!PR.isEmpty(this.aForms[sFormId].el.attr('action'))?this.aForms[sFormId].el.attr('action'):window.location.toString();if(this.aForms[sFormId].disableForm==true)
{PR.Form.disableForm(sFormId);}
$.ajax({type:"POST",url:sUrl,dataType:'json',data:this.aForms[sFormId].el.serialize(),success:function(aResponse)
{if(PR.Form.aForms[sFormId].disableForm==true)
{PR.Form.enableForm(sFormId);}
if(aResponse.success==true)
{var bReset=true;if(typeof PR.Form.aForms[sFormId].complete!='undefined')
{bReset=PR.Form.aForms[sFormId].complete(aResponse);}
if(bReset!=false)
{PR.Form.resetForm(sFormId);}}
else
{PR.Form.resetCaptcha(sFormId);if(!PR.isEmpty(aResponse.errors))
{$("#"+sFormId).validate().showErrors(aResponse.errors);}
if(typeof PR.Form.aForms[sFormId].failure!='undefined')
{PR.Form.aForms[sFormId].failure(aResponse);}}},error:function(oXMLHttpRequest,sTextStatus,sErrorThrown)
{if(typeof bDisableForm!='undefined')
{PR.Form.enableForm(sFormId);}}});return false;},disableForm:function(sFormId)
{var aFormCoordinates=$('#'+sFormId).position();var iFormWidth=$('#'+sFormId).width();var iFormHeight=$('#'+sFormId).height();if(/submit/.test(this.sFormDisableMode))
{$('#'+sFormId+' input[type=submit]').each(function(oItem,iIndex,aArray){oItem.disabled=true;});}
if(/shim/.test(this.sFormDisableMode))
{if(typeof this.aForms[sFormId].oShim=='undefined')
{this.aForms[sFormId].oShim=$("<div>").addClass('form-shim').css({'position':'absolute','left':aFormCoordinates.left,'top':aFormCoordinates.top,'width':iFormWidth,'height':iFormHeight});}
$(document.body).append(this.aForms[sFormId].oShim);}
if(/loader/.test(this.sFormDisableMode))
{if(typeof this.aForms[sFormId].oLoader=='undefined')
{this.aForms[sFormId].oLoader={oOuter:$("<div>").addClass('form-loader-outer').css({'position':'absolute','left':'-10000px','top':'-10000px'}),oInner:$("<div>").addClass('form-loader-inner').html('<img src="'+LINK_ROOT+'/images/spinner.gif" /> Bezig met verwerken')};$(document.body).append(this.aForms[sFormId].oShim);this.aForms[sFormId].oLoader.oOuter.appendTo(this.aForms[sFormId].oLoader.oInner);}
$('#'+sFormId).append(this.aForms[sFormId].oLoader.oOuter);var iLoaderWidth=this.aForms[sFormId].oLoader.oOuter.width();var iLoaderHeight=this.aForms[sFormId].oLoader.oOuter.height();var x=aFormCoordinates.left+((iFormWidth-iLoaderHeight)/2);var y=aFormCoordinates.top+((iFormHeight-iLoaderHeight)/2);this.aForms[sFormId].oLoader.oOuter.css('left',x);this.aForms[sFormId].oLoader.oOuter.css('top',y);}},enableForm:function(sFormId)
{if(/submit/.test(this.sFormDisableMode))
{$('#'+sFormId+' input[type=submit]').each(function(oItem,iIndex,aArray){oItem.disabled=false;});}
if(/shim/.test(this.sFormDisableMode))
{this.aForms[sFormId].oShim.remove();}
if(/loader/.test(this.sFormDisableMode))
{this.aForms[sFormId].oLoader.oOuter.css('left','-10000');this.aForms[sFormId].oLoader.oOuter.css('top','-10000');}},setFormDisableMode:function(sFormDisableMode)
{this.sFormDisableMode=sFormDisableMode;},resetForm:function(sFormId,bResetHiddenFields,aIgnoreFields)
{$('#'+sFormId+' select, #'+sFormId+' input, #'+sFormId+' textarea').each(function(index,item)
{if((typeof bResetHiddenFields=='undefined'||bResetHiddenFields!=false||item.type!='hidden')&&(typeof aIgnoreFields=='undefined'||aIgnoreFields==false||aIgnoreFields.indexOf(item.name)<0)&&$(item.name))
{switch(item.type)
{case"select-one":case"select-multiple":for(var selectrow=0;selectrow<item.options.length;selectrow++)
{item.options[selectrow].selected=item.options[selectrow].defaultSelected;}
break;case"checkbox":case"radio":item.checked=item.defaultChecked;break;default:item.value=item.defaultValue;break;}}});PR.Form.resetCaptcha(sFormId);},resetCaptcha:function(sFormId)
{var aCaptcha=$('#'+sFormId+' input[name^=captcha]');if(aCaptcha.length>0)
{aCaptcha.each(function(iIndex,oCaptchaEl)
{$('#'+sFormId+'_captcha_for_'+$(oCaptchaEl).attr('name')).attr('src',$('#'+sFormId+'_captcha_for_'+$(oCaptchaEl).attr('name')).attr('src')+'&1');});}}};

PR.Form.File_Progress=function(aOptions)
{var oSWFUpload;var aFileQueue={};var iTotalSize=0;var bHasFileToUpload=false;var sDisplayEl='#display_'+aOptions.elementId;var sQueueEl='#file_queue_'+aOptions.elementId;var sFileDataEl='#filedata_'+aOptions.elementId;var sProgressEl='#file_progress_'+aOptions.elementId;var sFormEl='#'+aOptions.formId;function reset()
{$(sDisplayEl).val("");$(sFileDataEl).val("");if(!PR.isEmpty(aFileQueue))
{for(sFileId in aFileQueue)
{oSWFUpload.cancelUpload(sFileId);};}
iTotalSize=0;bHasFileToUpload=false;aFileQueue={};}
function fileDialogStart()
{if(aOptions.queueSize==1)
{reset();}}
function fileQueueError(file,errorCode,message)
{try
{switch(errorCode)
{case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:alert("Er staan te veel bestanden in de wachtrij.\n"+(message===0?"Je hebt de limiet voor het aantal bestand bereikt.":"Je mag "+(message>1?"tot "+message+" bestanden selecteren.":"een bestand selecteren.")));return;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:alert("Het geselecteerde bestand is te groot.");this.debug("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+message);return;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:alert("Het geselecteerde bestand is leeg, selecteer een ander bestand.");this.debug("Error Code: Zero byte file, File name: "+file.name+", File size: "+file.size+", Message: "+message);return;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:alert("Het geselecteerde bestand heeft niet het goede formaat.");this.debug("Error Code: Invalid File Type, File name: "+file.name+", File size: "+file.size+", Message: "+message);return;default:alert("Er is een fout onstaan tijdens het versturen van het bestand, probeer het later nogmaals.");this.debug("Error Code: "+errorCode+", File name: "+file.name+", File size: "+file.size+", Message: "+message);return;}}
catch(e){}}
function fileRemoveFromQueue(oEvent)
{var sId=$($(this).parent().get(0)).attr('id').replace(/file_/,'');oSWFUpload.cancelUpload(sId);$($(this).parent().get(0)).remove();iTotalSize=iTotalSize-aFileQueue[sId].size;delete aFileQueue[sId];if(PR.isEmpty(aFileQueue))
{reset();}}
function fileQueued(file)
{if(aOptions.queueSize==0)
{alert("U heeft de limiet voor het aantal bestand bereikt, u moet eerst een bestand verwijderen indien u een andere wilt uploden.");return false;}
bHasFileToUpload=true;aFileQueue[file.id]=file;iTotalSize+=file.size;if(aOptions.queueSize==1)
{$(sDisplayEl).val(file.name);}
else if(aOptions.queueSize>1)
{$(sDisplayEl).val(PR.getLabel('1 of meerdere bestanden klaargezet'));$(sQueueEl).append($('<div>').attr('id',"file_"+file.id).html(file.name).prepend($('<img>').attr('src',LINK_ROOT+'/images/delete.png').click(fileRemoveFromQueue)));}}
function fileDialogComplete(numFilesSelected,numFilesQueued)
{}
function startUpload(sFileId)
{if(aOptions.queueSize>1)
{$('#file_'+sFileId+' img:first').unbind('click',fileRemoveFromQueue).attr('src',LINK_ROOT+'/images/spinner.gif');}
oSWFUpload.startUpload(sFileId);}
function uploadProgress(file,bytesLoaded,bytesTotal)
{aFileQueue[file.id].bytesLoaded=bytesLoaded;var iTotalbytesLoaded=0;for(sFileId in aFileQueue)
{iTotalbytesLoaded+=typeof aFileQueue[sFileId].bytesLoaded!='undefined'?aFileQueue[sFileId].bytesLoaded:0;};var percent=Math.ceil((iTotalbytesLoaded/iTotalSize)*100);if($(sProgressEl).css('display')=='none')
{$(sProgressEl).css('display','block');}
$(sProgressEl+' div').css('width',percent+'%');$(sProgressEl+' div').html(percent+'%');}
function uploadSuccess(file,serverData)
{aFileQueue[file.id].tempname=serverData;}
function uploadComplete(file)
{if(aOptions.queueSize>1)
{$('#file_'+file.id+' img:first').attr('src',LINK_ROOT+'/images/accept.png');}}
function queueComplete(file)
{bHasFileToUpload=false;PR.Form.File_Progress.prototype.iUploadsInProgress--;var aFiles=[];for(sFileId in aFileQueue)
{aFiles.push([aFileQueue[sFileId].tempname,aFileQueue[sFileId].name]);}
$(sFileDataEl).val($.toJSON(aFiles));if(PR.Form.File_Progress.prototype.iUploadsInProgress==0)
{$(sFormEl).submit();}}
function uploadError(file,errorCode,message)
{}
$(function()
{var aSwfOptions={upload_url:LINK_ROOT+'/actions/act_upload.php',file_post_name:"resume_file",flash_url:LINK_ROOT+"/libs/SWFUpload/Flash/swfupload.swf",file_size_limit:aOptions.iMaxFileSize,file_types:"*.*",file_types_description:"All Files",file_upload_limit:"0",file_queue_limit:aOptions.queueSize,file_dialog_start_handler:fileDialogStart,file_queued_handler:fileQueued,file_queue_error_handler:fileQueueError,file_dialog_complete_handler:fileDialogComplete,upload_progress_handler:uploadProgress,upload_error_handler:uploadError,upload_success_handler:uploadSuccess,upload_complete_handler:uploadComplete,queue_complete_handler:queueComplete,button_image_url:LINK_ROOT+aOptions.button.img,button_placeholder_id:"spanButtonPlaceholder"+aOptions.elementId,button_width:aOptions.button.width,button_height:aOptions.button.height};if(!PR.isEmpty(aOptions.aSwfOptions))
{aSwfOptions=$.extend(aSwfOptions,aOptions.aSwfOptions);}
oSWFUpload=new SWFUpload(aSwfOptions);$(sFormEl).submit(function(event)
{try
{if(bHasFileToUpload==true)
{PR.Form.File_Progress.prototype.iUploadsInProgress++;for(sFileId in aFileQueue)
{startUpload(sFileId);};return false;}}
catch(e)
{}
return true;});});};PR.Form.File_Progress.prototype.iUploadsInProgress=0;

PR.Form.Rating={aElements:{},register:function(sElementId,oElement)
{PR.Form.Rating.aElements[sElementId]=oElement;},get:function(sElementId)
{PR.Form.Rating.aElements[sElementId];},rating:function(sElementId,sFormId,iComponentId,iComponentItemId,aOptions)
{var sTooltipText='';this.submit=function(sValue,oLink)
{$.get(LINK_ROOT+"/rating/add",{component_id:iComponentId,component_item_id:iComponentItemId,value:sValue},function(aData)
{if(!PR.isEmpty(aOptions.showTooltips)&&aOptions.showTooltips==true)
{sTooltipText=aData.html;$("#"+sFormId+'_'+sElementId+"-title").html(aData.html);}
$("#"+sFormId+'_'+sElementId+"-container .star").rating('disable');},'json');}
this.setOption=function(sOption,sValue)
{aOptions[sOption]=sValue;}
this.getOption=function(sOption)
{return aOptions[sOption];}
var aRatingOptions={};if(!PR.isEmpty(aOptions.required)&&aOptions.required==true)
{aRatingOptions.required=true;}
if(!PR.isEmpty(aOptions.submitOnClick)&&aOptions.submitOnClick==true)
{aRatingOptions.callback=this.submit;}
if(!PR.isEmpty(aOptions.showTooltips)&&aOptions.showTooltips==true)
{aRatingOptions.focus=function(value,link){var tip=$("#"+sFormId+'_'+sElementId+"-title");if(sTooltipText=='')sTooltipText=tip.html();tip.html(link.title||value);}
aRatingOptions.blur=function(value,link){var tip=$("#"+sFormId+'_'+sElementId+"-title");tip.html(sTooltipText||"");}}
$("#"+sFormId+'_'+sElementId+"-container .star").rating(aRatingOptions);PR.Form.Rating.register(sFormId,this);}};

PR.Form.InputTip={tipActiveClass:'input-tip',addTips:function()
{$('input[type=text][title!=""], textarea[title!=""]').each(function(iIndex,oItem)
{this.addTip($(oItem));}.bind(this));},addTip:function(oInputField)
{this.setTip(oInputField);this.addTipEvents(oInputField);},setTip:function(oInputField)
{if(oInputField.val()=='')
{oInputField.val(oInputField.attr('title'));}
if(oInputField.val()==oInputField.attr('title'))
{oInputField.addClass(this.tipActiveClass);}},addTipEvents:function(oInputField)
{$(oInputField.parents('form').get(0)).submit(function()
{if(oInputField.val()==oInputField.attr('title'))
{oInputField.val('');}});oInputField.focus(function()
{if(oInputField.val()==oInputField.attr('title'))
{oInputField.val('');}
oInputField.removeClass(this.tipActiveClass);}.bind(this));oInputField.blur(function()
{if(oInputField.val()=='')
{oInputField.val(oInputField.attr('title'));oInputField.addClass(this.tipActiveClass);}}.bind(this));}};

PR.AjaxPager={aPagers:{},create:function(sListName,iNumberOfPages,iCurrentPage,sUrl)
{if(PR.isEmpty(this.aPagers[sListName]))
{this.aPagers[sListName]=new PR.AjaxPager.Pager(sListName,iNumberOfPages,iCurrentPage,sUrl);}
return this.aPagers[sListName];},get:function(sListName)
{if(!PR.isEmpty(this.aPagers[sListName]))
{return this.aPagers[sListName];}
return false;},Pager:function(sListName,iNumberOfPages,iCurrentPage,sUrl)
{this.sListName=sListName;this.iNumberOfPages=iNumberOfPages;this.iCurrentPage=iCurrentPage;this.sUrl=!PR.isEmpty(sUrl)?sUrl:window.location.href;var oUrl=new PR.Url(this.sUrl);var bIsPaging=false;this.addEvents({'beforepage':true,'page':true});this.load=function(iPage,fOnComplete,bForceLoad)
{if(bIsPaging==true)
{return false;}
bIsPaging=true;var bResult=this.fireEvent('beforepage');if(bResult===false)
{return;}
if((parseInt(iPage)<=this.iNumberOfPages&&parseInt(iPage)>0&&parseInt(iPage)!=this.iCurrentPage)||(typeof(bForceLoad)!='undefined'&&bForceLoad==true))
{if(PR.useHashNavigation&&oUrl.hasHash())
{oUrl.setLink(LINK_ROOT+oUrl.getHash());}
$.get(oUrl.addParam('bIsAjaxPagerRequest',1).addParam('sListId',sListName).addParam(sListName+'_p',iPage),function(sData)
{this.iCurrentPage=parseInt(iPage);$('#'+this.sListName).html(sData);if(typeof fOnComplete!='undefined')
{fOnComplete(parseInt(iPage),sData);}
bIsPaging=false;this.fireEvent('page');}.bind(this));}
return false;}}};Ext.extend(PR.AjaxPager.Pager,Ext.util.Observable);

PR.Website={bCarrouselAnimationActive:false,setActiveMother:function(sMotherKey,sType)
{if(PR.Website.bCarrouselAnimationActive==false&&$('.carrousel #mother_'+sMotherKey).length==0)
{PR.Website.bCarrouselAnimationActive=true;$.get(LINK_ROOT+"/Moeders/homepage/"+sMotherKey,{homepage:1,type:sType},function(sHtml)
{$('.carrousel .main-menu .active').removeClass('active');$('.carrousel #carrousel_menu_'+sMotherKey).addClass('active');$('.carrousel .slide').replaceWith(sHtml);PR.Form.InputTip.addTips();PR.Website.bCarrouselAnimationActive=false;});}},removeClasses:function()
{$(document.body).removeClass('green_light green_sea blue_light blue_dark blue_deep purple_light purple_dark complication pregnant born_name_not_known born_winner');},setClass:function(aClasses)
{this.removeClasses();$(document.body).addClass(aClasses.color+' '+aClasses.status);},validateName:function(oInputField,fOnValid)
{$.get(LINK_ROOT+"/Bestaande-namen/validateName",{babyname:oInputField.val()},function(sIsValid)
{if(sIsValid=='true'&&oInputField.attr('title')!=oInputField.val())
{oInputField.removeClass('invalid');if(typeof(fOnValid)!='undefined')
{fOnValid();}}
else
{oInputField.addClass('invalid');}});},validateCode:function(oInputField,fOnvalid)
{if(oInputField.val().length==6)
{$.get(LINK_ROOT+"/Wincodes/validateCode",{actioncode:oInputField.val()},function(oResponse)
{if(oResponse.valid==1&&oInputField.attr('title')!=oInputField.val())
{oInputField.removeClass('invalid');window.location=LINK_ROOT+'/Wincodes/controleercode/?code='+oResponse.tbl_actioncodes_name;if(typeof(fOnValid)!='undefined')
{fOnValid();}}
else
{PR.Website.invalideCodeTip('De ingevoerde code is onjuist');oInputField.addClass('invalid');}},'json');}
else
{PR.Website.invalideCodeTip('De ingevoerde code is onjuist');oInputField.addClass('invalid');}},invalideCodeTip:function(err)
{if($('#invalidcode').length==0){$('#actie-check').append("<div id='invalidcode' style='display: none;'></div>");}
$('#invalidcode').html(err);$('#invalidcode').show('drop',{},1000,function(){setTimeout(function(){$('#invalidcode').hide('drop');},3000);});},SubmitNameForm:function(iMotherId)
{this.validateName($('#name_'+iMotherId+' input[name=babyname]'),function()
{$('#name_'+iMotherId).submit();});},SubmitCodeForm:function()
{this.validateCode($('#actie-check-form-code'),function(){PR.debug('code is valid');});},voteForName:function(sNameKey,sMotherKey)
{$.get(LINK_ROOT+"/Namen/"+sNameKey+"/stem",{},function(aData)
{var html=aData.message;html+='<div class="blijf-op-de-hoogte-wrapper"><a href="'+LINK_ROOT+'/profiel/aanmelden/" ><div class="blijf-op-de-hoogte"></div></a></div>';$('#'+sMotherKey+'-stem-verwerkt').html(html).show('drop',{},1000,function(){setTimeout(function(){$('#'+sMotherKey+'-stem-verwerkt').hide('drop');},10000);});},'json');},showEmbed:function(sVideoKey)
{return"<div class='embed_explanation'>"+$('#embed_video_block').html()+'<textarea onfocus="this.select()">'+PR.SwfObject.getEmbedCode(sVideoKey)+'</textarea></div> ';},showLink:function()
{var oUrl=new PR.Url();if(oUrl.hasHash()&&oUrl.getHash().length>1)
{oUrl=new PR.Url(LINK_ROOT+oUrl.getHash());}
return"<div class='embed_explanation embed_link_explanation'>"+$('#link_video_block').html()+'<textarea onfocus="this.select()">'+oUrl+'</textarea></div> ';},checkSubscriptionAvailability:function()
{$.get(LINK_ROOT+"/Inschrijvingen/beschikbaar",{},function(aData)
{if($('#num_available_subscriptions').length>0)
{$('#num_available_subscriptions').html(aData);setTimeout(PR.Website.checkSubscriptionAvailability,2500);}});},run:function(){PR.Form.InputTip.addTips();$("a[rel^='prettyPhoto']").prettyPhoto();$('.tooltip[title!=""]').tooltip();$('#background .inner').width($(document.body).width());$('#background .inner').height($(window).height());$(window).resize(function()
{$('#background .inner').width($(document.body).width());$('#background .inner').height($(window).height());});$("#actie-check-form-code").keypress(function(e){if((e.which&&e.which==13)||(e.keyCode&&e.keyCode==13)){PR.Website.validateCode($('#actie-check-form-code'));return false;}else{return true;}});$('#actie-check-form-submitter').bind('click',function(){PR.Website.validateCode($('#actie-check-form-code'));});$('#background .inner').append('<img src="'+LINK_ROOT+'/images/design/dolfinarium.jpg" />');PR.useHashNavigation=true;var isIE6=!$.support.opacity&&!window.XMLHttpRequest;if(isIE6){DD_belatedPNG.fix('.block-mother, .block-mother-tabs a, .block-mother-blog, .block-mother-blog-image, .block-mother-blog-button, .events-trans, .action-button, .events-image-top, .illustration .shime, .block-mother-righttext .date, .block-mother-text, .events-text ');}
$.historyInit(PR.navigateToUrl);},cloneEmail:function(){var oEcardEmail=document.getElementById('ecard-email');var oRow=oEcardEmail.getElementsByTagName('tr');if(oEcardEmail.getElementsByTagName('tr').length<10){var oClone=$(oRow[oRow.length-1]).clone();var oInput=$('input',oClone)[0];var iNumber=parseInt(oInput.id.match(/\d/g))+1;$('span',oClone)[1].id='tbl_ecard_sending_email_'+iNumber+'_error';oInput.id='tbl_ecard_sending_email_'+iNumber;oInput.name='tbl_ecard_sending_email_'+iNumber;oInput.value='';$(oEcardEmail).append(oClone);}else{document.getElementById('ecard-email-button').style.display='none';}
return false;},checkSms:function(){if($('#tbl_profile_sms').attr('checked')){$('#tbl_profile_mobile_row').show();$("#tbl_profile_mobile").rules("add",{required:true,messages:{required:'Mobiel nummer is verplicht'}});}else{$('#tbl_profile_mobile_row').hide();$("#tbl_profile_mobile").rules("remove","required");}}};

PR.Chat_Session={aChatSessions:{},registerSession:function(iChatSessionId,oSession)
{this.aChatSessions[iChatSessionId]=oSession;},getSession:function(iChatSessionId)
{return PR.Chat_Session.aChatSessions[iChatSessionId];},kickChatUser:function(iChatUserId)
{var bTest=window.confirm(PR.getLabel('Weet je zeker dat je deze gebruiker niet meer in de chat wilt toelaten?'));if(bTest)
{$.get(LINK_ROOT+"/Chat-Sessies/kick",{tbl_chat_user_id:iChatUserId},function(sResponse)
{window.alert(sResponse);});}}};PR.Chat_Session.Session=function(iChatSessionId,sChatSessionKey)
{var oSync;this.setUsers=function(sUsers)
{$('#chat_session_'+sChatSessionKey+' .chat_users').html(sUsers);}
this.setMessages=function(sMessages)
{$('#chat_session_'+sChatSessionKey+' .chat_log').append(sMessages);$('#chat_session_'+sChatSessionKey+' .chat_log').attr({scrollTop:$('#chat_session_'+sChatSessionKey+' .chat_log').attr("scrollHeight")});$('#chat_session_'+sChatSessionKey+' .chat_log .tooltip[title!=""]').tooltip();}
PR.Chat_Session.registerSession(iChatSessionId,this);oSync=new PR.Synchronization(LINK_ROOT+'/Chat-Sessies/'+sChatSessionKey+'/synchronize',{'users':{fn:this.setUsers,scope:this},'log_update':{fn:this.setMessages,scope:this}},{interval:3});oSync.run();};

