/*[0ms]*/if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());RegExp.escape=function(a){return String(a).replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")};var DMP=(function(c){var e={Popup:{el:null,img:null,h:467,b:false,t:null,event:function(i){var h=e.Popup;switch(i.type){case"mouseover":case"mouseenter":var f=c(this);if(h.t){window.clearTimeout(h.t)}if(h.b){return false}h.img.attr({src:f.attr("full")&&f.attr("full").length>0?f.attr("full"):f.attr("src")});var j=document.all?document.documentElement.scrollTop:window.pageYOffset;var g=j+(document.all?document.documentElement.scrollHeight:window.innerHeight);h.t=window.setTimeout(function(){h.el.css({visibility:"hidden"});h.el.css({display:"block"});h.el.css({left:(c(document).width()-h.el.width())>>1});h.h=h.img.height();c(h.el).css({top:i.pageY-j>g-i.pageY?i.pageY-h.h-20:i.pageY+20});h.el.css({visibility:"visible"})},250);c(document.body).mousemove(h.Body.move);break;case"mouseout":case"mouseleave":if(h.t){window.clearTimeout(h.t)}h.el.css({display:"none"}).find("img").attr({src:"/Images/ajax-loader.gif"});c(document.body).unbind("mousemove",h.Body.move);break;case"mousedown":if(h.t){window.clearTimeout(h.t)}i.preventDefault();h.el.css({display:"none"}).find("img").attr({src:"/Images/ajax-loader.gif"});h.b=true;c(document.body).unbind("mousemove",h.Body.move).mouseup(h.Body.up);break}},Body:{move:function(g){var h=document.all?document.documentElement.scrollTop:window.pageYOffset;var f=h+(document.all?document.documentElement.scrollHeight:window.innerHeight);c(e.Popup.el).css({top:g.pageY-h>f-g.pageY?g.pageY-e.Popup.h-20:g.pageY+20})},up:function(){e.Popup.b=false}}},preload:function(){DMP.Images.list=[];var f=arguments;window.setTimeout(function(){for(var g=0;g<f.length;g++){var h=new Image();h.src=f[g];DMP.Images.list.push(h)}},0)}},a={Default:{each:function(){var f=c(this);f.css({color:f.val()===f.attr("default")?"#888":"#333"})},event:function(g){var f=c(this);switch(g.type){case"focus":case"focusin":if(f.val()===f.attr("default")){f.val("")}f.css({color:"#333"});break;case"blur":case"focusout":if(f.val()===""){f.val(f.attr("default"))}f.css({color:f.val()===f.attr("default")?"#888":"#333"});break}}},TextFilter:{event:function(h){switch(h.type){case"keypress":var g=h.which;if(g<=31||g>=127||h.ctrlKey){return}if(!this.chars){this.chars=c(this).attr("chars")}var i=String.fromCharCode(g);if(this.chars.indexOf(i)===-1){h.preventDefault()}break;case"change":if(!this.chars){this.chars=c(this).attr("chars")}var f=c(this);f.val(f.val().replace(new RegExp("[^"+RegExp.escape(this.chars)+"]","gi"),""));break}}},TextArea:{MaxLength:{event:function(j){var h=c(this),g=h.attr("maxlength")>>0,f=h.val().length,l=true,k=0;switch(j.type){case"focus":case"focusin":if(h.parent().get(0).nodeName.toLowerCase()!=="label"||h.parent().children().get(0).nodeName.toLowerCase()!=="br"){return}h.parent().children().eq(0).before('<span class="Remaining Characters" style="display:inline-block;padding-left:40px;">'+(g-h.val().length)+" characters remaining</span>");break;case"blur":case"focusout":h.parent().find("span.Remaining.Characters").remove();break;case"keydown":window.setTimeout(function(){h.parent().find("span.Remaining.Characters").html((g-h.val().length)+" characters remaining")},0);break;case"keypress":case"input":var i=j.which;if(i<=9||i===11||i===12||(i>=14&&i<=31)||i>=127){return}k=a.TextArea.MaxLength.getSelectionLength(this);if(f-k>=g){l=false}window.setTimeout(function(){h.parent().find("span.Remaining.Characters").html((g-h.val().length)+" characters remaining")},0);j.returnValue=l;return l;case"paste":h=c(j.target);g=h.attr("maxlength")>>0;f=h.val().length;if(h.get(0).nodeName.toLowerCase()!=="textarea"||!h.attr("maxlength")){return}k=a.TextArea.MaxLength.getSelectionLength(h.get(0));if(f-k>g){l=false}window.setTimeout(function(){if(h.val().length>g){h.val(h.val().substring(0,g))}h.parent().find("span.Remaining.Characters").html((g-h.val().length)+" characters remaining")},0);j.returnValue=l;return l}},getSelectionLength:function(f){if(f.selectionStart===undefined){return document.selection.createRange().text.length}else{return f.selectionEnd-f.selectionStart}}}}},b={refresh:function(){window.location.reload()},Session:{execute:function(k,i,j,f,h){var g=JSON.stringify({query:i});if(h===undefined){h=false}c.ajax({type:"POST",url:"/SetSessionVars.aspx/"+k,data:g,beforeSend:function(l){l.setRequestHeader("Content-Type","application/json; charset=UTF-8");l.setRequestHeader("Content-Length",g.length)},contentType:"application/json; charset=UTF-8",dataType:"json",success:j,error:f,async:!h})},Guid:function(h,i,f,g){if(g===undefined){g=false}b.Session.execute("Guid",h,i,f,g)},Boolean:function(h,i,f,g){if(g===undefined){g=false}b.Session.execute("Boolean",h,i,f,g)},String:function(h,i,f,g){if(g===undefined){g=false}b.Session.execute("String",h,i,f,g)}},Methods:{create:function(g,f){return function(k,l,h,j){var i=JSON.stringify({query:k});if(j===undefined){j=false}c.ajax({type:"POST",url:g+"/"+f,data:i,beforeSend:function(m){m.setRequestHeader("Content-Type","application/json; charset=UTF-8");m.setRequestHeader("Content-Length",i.length)},contentType:"application/json; charset=UTF-8",dataType:"json",success:l,error:h,async:!j})}}},Validators:{list:[],Group:function(h){var g=h.attr("group"),f=[];if(!g){c("<p>No validation group name has been set for this group</p>").dialog({modal:true,buttons:{Ok:function(){c(this).dialog("close")}}})}if(b.Validators.list[g]!==undefined){c('<p>A validation group named "'+g+'" already exists</p>').dialog({modal:true,buttons:{Ok:function(){c(this).dialog("close")}}})}h=h.wrap('<ul class="Error"/>').contents().unwrap().parents("ul:first").hide();h.find("dmp\\:required,required").each(function(){f.push(new b.Validators.Required(c(this)))});h.find("dmp\\:expression,expression").each(function(){f.push(new b.Validators.Expression(c(this)))});h.find("dmp\\:equal,equal").each(function(){f.push(new b.Validators.Equal(c(this)))});h.find("dmp\\:range,range").each(function(){f.push(new b.Validators.Range(c(this)))});this.validate=function(j){if(j===undefined){j=false}var l=true,m=false;if(!j){h.show()}for(var k=0;k<f.length;k++){if(!f[k].validate(j)){if(!j&&!m){f[k].element.focus();m=true}l=false}}if(l){h.hide()}return l};b.Validators.list[g]=this},Required:function(g){var f=c("#"+g.attr("control"));this.element=f;if(f.length===0){c('<p>No control with id "'+g.attr("control")+'" can be found</p>').dialog({modal:true,buttons:{Ok:function(){c(this).dialog("close")}}})}g=g.wrap("<li/>").contents().unwrap().parents("li:first");this.validate=function(h){if(!h){g.show()}f.unbind("change",this.validate);if(f.val()===""||(f.attr("default")&&f.val()===f.attr("default"))){if(!h){f.addClass("Error").bind("change",this.validate)}return false}g.hide();f.removeClass("Error");return true}},Expression:function(h){var g=c("#"+h.attr("control")),i=h.attr("value"),f=h.attr("reverse")&&h.attr("reverse")==="true"?true:false;this.element=g;if(g.length===0){c('<p>No control with id "'+h.attr("control")+'" can be found</p>').dialog({modal:true,buttons:{Ok:function(){c(this).dialog("close")}}})}if(!i){c('<p>No validation expression has been set for control "'+h.attr("control")+'"</p>').dialog({modal:true,buttons:{Ok:function(){c(this).dialog("close")}}})}h=h.wrap("<li/>").contents().unwrap().parents("li:first");this.validate=function(j){if(!j){h.show()}g.unbind("change",this.validate);if((!f&&!new RegExp(i).test(g.val()))||(f&&new RegExp(i).test(g.val()))){if(!j){g.addClass("Error").bind("change",this.validate)}return false}h.hide();g.removeClass("Error");return true}},Equal:function(i){var h=c("#"+i.attr("control")),g=c("#"+i.attr("compare")),f=i.attr("reverse")&&i.attr("reverse")==="true"?true:false;this.element=h;if(h.length===0){c('<p>No control with id "'+i.attr("control")+'" can be found</p>').dialog({modal:true,buttons:{Ok:function(){c(this).dialog("close")}}})}if(g.length===0){c('<p>No control with id "'+i.attr("compare")+'" can be found</p>').dialog({modal:true,buttons:{Ok:function(){c(this).dialog("close")}}})}i=i.wrap("<li/>").contents().unwrap().parents("li:first");this.validate=function(j){if(!j){i.show()}h.add(g).unbind("change",this.validate);if((!f&&h.val()!==g.val())||(f&&h.val()===g.val())){if(!j){h.add(g).addClass("Error").bind("change",this.validate)}return false}i.hide();h.add(g).removeClass("Error");return true}},Range:function(k){var j=c("#"+k.attr("control")),i=k.attr("min")!==""?k.attr("min"):null,g=k.attr("max")!==""?k.attr("max"):null,f=k.attr("inclusive")&&k.attr("inclusive")==="false"?false:true,h=k.attr("reverse")&&k.attr("reverse")==="true"?true:false;this.element=j;if(j.length===0){c('<p>No control with id "'+k.attr("control")+'" can be found</p>').dialog({modal:true,buttons:{Ok:function(){c(this).dialog("close")}}})}k=k.wrap("<li/>").contents().unwrap().parents("li:first");this.validate=function(l){if(!l){k.show()}j.unbind("change",this.validate);if(f){if((!h&&((i!==null&&j.val()<i)||(g!==null&&j.val()>g)))||(h&&((i!==null&&j.val()>=i)&&(g!==null&&j.val()<=g)))){if(!l){j.addClass("Error").bind("change",this.validate)}return false}}else{if((!h&&((i!==null&&j.val()<=i)||(g!==null&&j.val()>=g)))||(h&&((i!==null&&j.val()>i)&&(g!==null&&j.val()<g)))){if(!l){j.addClass("Error").bind("change",this.validate)}return false}}k.hide();j.removeClass("Error");return true}}}},d=function(f){f=f||c(document.body);f.find("input[default],textarea[default]").each(a.Default.each)};c(function(){c("dmp\\:validate,validate").hide().each(function(){new b.Validators.Group(c(this))});c('img[popup="yes"]').live("mouseenter mouseleave mousedown",e.Popup.event);c("input[default],textarea[default]").each(a.Default.each).live("focus blur",a.Default.event);c("input[chars],textarea[chars]").live("keypress change",a.TextFilter.event);c("textarea[maxlength]").live("focus blur keydown keypress input",a.TextArea.MaxLength.event);c(document.body).bind("paste",a.TextArea.MaxLength.event);if(e.Popup.el===null){c(document.body).prepend('<div id="divPopup" style="background:#666;border:1px solid #ddd;display:none;max-width:700px;padding:0px;position:absolute;z-index:200"><img id="imgPopup" src="/Images/ajax-loader.gif" alt="Popup Photo" style="height:auto;max-width:700px;width:auto" /></div>');e.Popup.el=c("#divPopup");e.Popup.img=c("#imgPopup")}});return{bind:d,Images:{preload:e.preload},Page:{refresh:b.refresh,Methods:b.Methods,Session:{Guid:b.Session.Guid,Boolean:b.Session.Boolean,String:b.Session.String},Validators:{Groups:b.Validators.list}}}}(jQuery));
