var AKA=AKA||{};AKA.ExceptionHandlingLoaded=typeof AKA.ExceptionHandling!="undefined";AKA.ExceptionHandling=AKA.ExceptionHandling||{};AKA.ExceptionHandlingLoaded||function(n){function a(n){return new Date(parseInt(n.replace("/Date(","").replace(")/",""),10))}function v(){var i,u,s,t,n,f,h,r,e,c;try{i=[];u=!1;try{n.dont.exist+=0}catch(o){if(o.stack){for(t=o.stack.split("\n"),s=!1,n=0,f=t.length;n<f;n++)s&&i.push(t[n]),t[n].match(/HandleError/)&&(s=!0);u=!0}else if(window.opera&&o.message){for(t=o.message.split("\n"),n=0,f=t.length;n<f;n++)t[n].match(/^\s*[A-Za-z0-9\-_\$]+\(/)&&(h=t[n],t[n+1]&&(h+=" at "+t[n+1],n++),i.push(h));i.shift();u=!0}}if(!u)for(r=arguments.callee.caller;r;)e=r.toString(),c=e.substring(e.indexOf("function")+8,e.indexOf(""))||"anonymous",i.push(c),r=r.caller;return i.join("\n\n")}catch(l){return"N/A"}}function u(t,i){var r=n("[data-valmsg-for='"+t+"']");r.removeClass("field-validation-valid").addClass("field-validation-error");r.text("");i instanceof Array?n(i).each(function(n){r.text(r.text()+i[n])}):typeof i!="undefined"&&r.text(i)}function y(n){i("Fatal",n);s||alert(n.message)}function p(n){i("Error",n)}function w(n){i("Warning",n)}function i(n){i("Tracing",n)}function i(severity,error){var location,traceObj,consoleMethod,serverpart;try{if(location=typeof error.location=="undefined"?"client":error.location,traceObj={severity:severity,time:typeof error.time=="undefined"?new Date:typeof error.time=="string"?a(error.time):error.time,location:location,server:typeof error.server=="undefined"?"":error.server,message:typeof error.message=="undefined"?"Unknown error":error.message,code:typeof error.code=="undefined"?"unknown":error.code,description:typeof error.description=="undefined"?"":error.description,stack:severity!=="Tracing"&&location!=="server"?v():error.stack},o[g++]=traceObj,typeof console!="undefined"&&typeof console.log!="undefined"){switch(severity){case"Fatal":case"Error":consoleMethod=typeof(console.error!=="undefined")?"console.error":"console.log";break;case"Warning":consoleMethod=typeof(console.error!=="undefined")?"console.warn":"console.log";break;default:consoleMethod=typeof(console.info!=="undefined")?"console.info":"console.log"}serverpart=traceObj.location=="client"?"%s%s":"%s(%s)";eval(consoleMethod+'("%s: %s happened on '+serverpart+'.\\nError code:%s\\nMessage:%s\\nDescription:%s\\nStack Trace:%s", traceObj.time.toISOString(), traceObj.severity, traceObj.location, traceObj.server,traceObj.code, traceObj.message, traceObj.description, traceObj.stack)')}}catch(ex){}}function f(t){n(t).each(function(n){var i=t[n],r=typeof(i.messages==="undefined")||i.messages==null?i.message:i.messages;u(i.target,i.message)})}function e(n,t){if(typeof n.target=="undefined"||n.target==null)switch(n.severity){case l:y(n);break;case r:p(n);break;case c:w(n);break;case h:i(n)}else t(n)}function b(t){if(t.status==401&&(window.location.href=window.location.href),t.responseJSON!=undefined&&(t=t.responseJSON),typeof t._errors!="undefined"&&t._errors instanceof Array){var i=[];n(t._errors).each(function(n){e(t._errors[n],function(n){i[i.length]=n})});i.length>0&&f(i)}}function k(n,t){var i;i=n instanceof Object?n:{message:n.toString()};typeof t=="number"&&(i.severity=t);typeof i.severity=="undefined"&&(i.severity=r);e(i,function(n){f([n])})}function d(){s=!0}var o=[],g=0,s=!1,h=3,c=2,r=1,l=0,t=function(){};t.prototype.blockFatalMessages=d;t.prototype.errors=o;t.prototype.handleErrors=b;t.prototype.handleError=k;t.prototype.showFieldError=u;t.prototype.FATAL=l;t.prototype.ERROR=r;t.prototype.WARNING=c;t.prototype.TRACING=h;AKA.ExceptionHandling=new t}(typeof jQuery!="undefined"?jQuery:null)