/*[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(/([.*+?^=!:$\-{}()|[\]\/\\])/g,"\\$1")};(function(a){DMP=function(){var e={Popup:{el:null,img:null,h:467,b:false,t:null,event:function(j){var h=e.Popup;switch(j.type){case"mouseover":var f=a(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 k=document.all?document.documentElement.scrollTop:window.pageYOffset;var g=k+(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:(a(document).width()-h.el.width())>>1});h.h=h.img.height();a(h.el).css({top:j.pageY-k>g-j.pageY?j.pageY-h.h-20:j.pageY+20});h.el.css({visibility:"visible"})},250);a(document.body).mousemove(h.Body.move);break;case"mouseout":if(h.t){window.clearTimeout(h.t)}h.el.css({display:"none"}).find("img").attr({src:"/Images/ajax-loader.gif"});a(document.body).unbind("mousemove",h.Body.move);break;case"mousedown":if(h.t){window.clearTimeout(h.t)}event.preventDefault();h.el.css({display:"none"}).find("img").attr({src:"/Images/ajax-loader.gif"});h.b=true;a(document.body).unbind("mousemove",h.Body.move).mouseup(h.Body.up);break}return false},Body:{move:function(g){var h=document.all?document.documentElement.scrollTop:window.pageYOffset;var f=h+(document.all?document.documentElement.scrollHeight:window.innerHeight);a(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(i=0;i<f.length;i++){var g=new Image();g.src=f[i];DMP.Images.list.push(g)}},0)}},b={Default:{each:function(){var f=a(this);f.css({color:f.val()==f.attr("default")?"#888":"#333"})},event:function(g){var f=a(this);switch(g.type){case"focusin":if(f.val()==f.attr("default")){f.val("")}f.css({color:"#333"});break;case"focusout":if(f.val()==""){f.val(f.attr("default"))}f.css({color:f.val()==f.attr("default")?"#888":"#333"});break}return false}},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=a(this).attr("chars")}var j=String.fromCharCode(g);if(this.chars.indexOf(j)==-1){h.preventDefault()}break;case"change":if(!this.chars){this.chars=a(this).attr("chars")}var f=a(this);f.val(f.val().replace(new RegExp("[^"+RegExp.escape(this.chars)+"]","gi"),""));break}}},TextArea:{MaxLength:{event:function(l){switch(l.type){case"keypress":case"input":var k=l.which;if(k<=9||k==11||k==12||(k>=14&&k<=31)||k>=127){return}var h=a(this),f=h.val().length,n=true,m=b.TextArea.MaxLength.getSelectionLength(this);if(!this.max){this.max=parseInt(h.attr("maxlength"))}if(f-m>=this.max){n=false}if(f>this.max){h.val(h.val().substring(0,this.max))}l.returnValue=n;return n;case"paste":var h=a(this),j=window.clipboardData.getData("Text"),f=h.val().length,n=true,m=b.TextArea.MaxLength.getSelectionLength(this),g=f+j.length-m;if(!this.max){this.max=parseInt(h.attr("maxlength"))}if(g>this.max){n=false}l.returnValue=n;return n}},getSelectionLength:function(f){if(f.selectionStart==undefined){return document.selection.createRange().text.length}else{return f.selectionEnd-f.selectionStart}}}}},c={refresh:function(){window.location.reload()},Popup:{closing:null,open:function(m,k,n,j,h){c.Popup.closing=n!==undefined&&a.isFunction(n)&&n||null;a("#PopopBackground,#PopupContent").remove();a(document.body).prepend('<div id="PopupBackground" style="background:#000;border:1px solid #cecece;display:none;height:100%;left:0;position:fixed;_position:absolute;top:0;width:100%;z-index:100" title="Click Shadow To Close Popup">&nbsp;</div><div id="PopupContent" style="background:#'+(h=="White"?"fff":h=="Red"?"fbb":"cfc")+";border:2px solid #cecece;display:none;font-size:13px;padding:10px;position:fixed;_position:absolute;width:"+j+'px;z-index:200"><a class="Close" href="javascript:void(0)" style="color:#900;display:block;font-size:14px;font-weight:bold;line-height:14px;position:absolute;right:6px;top:4px" title="Close This Window">x</a><h1 style="border-bottom:1px dotted #d3d3d3;color:#'+(h=="White"?"333":h=="Red"?"900":"262")+';float:none;font-size:18px;font-weight:bold;margin:0px 0px 10px 0px;padding:0px;text-align:center">'+m+'</h1><div style="color:#'+(h=="White"?"333":h=="Red"?"900":"262")+'">'+k+"</div></div>");var l=document.documentElement.clientWidth,g=document.documentElement.clientHeight,f=a("#PopupContent").height();a("#PopupBackground").css({opacity:"0.7",height:g}).fadeIn(250);a("#PopupContent").css({position:"fixed",top:(g-f)>>1,left:(l-j)>>1}).fadeIn(250);a(document).bind("keypress",function(p){var o=p.which;if(o==27){c.Popup.close()}})},popup:function(h,g,j,f){c.Popup.open(h,g,j,f||360,"White")},complete:function(h,g,j,f){c.Popup.open(h,g,j,f||360,"Green")},error:function(h,g,j,f){c.Popup.open(h,g,j,f||360,"Red")},close:function(){if(c.Popup.closing!=null&&a.isFunction(c.Popup.closing)){c.Popup.closing()}a("#PopupBackground,#PopupContent").fadeOut(250,function(){a(this).remove()})}},Session:{execute:function(l,j,k,f,h){var g=JSON.stringify({query:j});if(h===undefined){h=false}a.ajax({type:"POST",url:"/SetSessionVars.aspx/"+l,data:g,beforeSend:function(m){m.setRequestHeader("Content-Type","application/json; charset=UTF-8");m.setRequestHeader("Content-Length",g.length)},contentType:"application/json; charset=UTF-8",dataType:"json",success:k,error:f,async:!h})},Guid:function(h,j,f,g){if(g===undefined){g=false}c.Session.execute("Guid",h,j,f,g)}},Methods:{create:function(g,f){return function(l,m,h,k){var j=JSON.stringify({query:l});if(k===undefined){k=false}a.ajax({type:"POST",url:g+"/"+f,data:j,beforeSend:function(n){n.setRequestHeader("Content-Type","application/json; charset=UTF-8");n.setRequestHeader("Content-Length",j.length)},contentType:"application/json; charset=UTF-8",dataType:"json",success:m,error:h,async:!k})}}},Validators:{list:[],Group:function(h){var g=h.attr("group"),f=[];if(!g){alert("No validation group name has been set for this group")}if(c.Validators.list[g]!==undefined){alert('A validation group named "'+g+'" already exists')}h=h.wrap('<ul class="Error"/>').contents().unwrap().parents("ul:first").hide();h.find((document.all?"":"dmp\\:")+"required").each(function(){f.push(new c.Validators.Required(a(this)))});h.find((document.all?"":"dmp\\:")+"expression").each(function(){f.push(new c.Validators.Expression(a(this)))});h.find((document.all?"":"dmp\\:")+"equal").each(function(){f.push(new c.Validators.Equal(a(this)))});h.find((document.all?"":"dmp\\:")+"range").each(function(){f.push(new c.Validators.Range(a(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};c.Validators.list[g]=this},Required:function(g){var f=a("#"+g.attr("control"));this.element=f;if(f.length==0){alert('No control with id "'+g.attr("control")+'" can be found')}var 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(g){var f=a("#"+g.attr("control")),h=g.attr("value");this.element=f;if(f.length==0){alert('No control with id "'+g.attr("control")+'" can be found')}if(!h){alert('No validation expression has been set for control "'+g.attr("control")+'"')}var g=g.wrap("<li/>").contents().unwrap().parents("li:first");this.validate=function(j){if(!j){g.show()}f.unbind("change",this.validate);if(!new RegExp(h).test(f.val())){if(!j){f.addClass("Error").bind("change",this.validate)}return false}g.hide();f.removeClass("Error");return true}},Equal:function(h){var g=a("#"+h.attr("control")),f=a("#"+h.attr("compare"));this.element=g;if(g.length==0){alert('No control with id "'+h.attr("control")+'" can be found')}if(f.length==0){alert('No control with id "'+h.attr("compare")+'" can be found')}var h=h.wrap("<li/>").contents().unwrap().parents("li:first");this.validate=function(j){if(!j){h.show()}g.add(f).unbind("change",this.validate);if(g.val()!=f.val()){if(!j){g.add(f).addClass("Error").bind("change",this.validate)}return false}h.hide();g.add(f).removeClass("Error");return true}},Range:function(j){var h=a("#"+j.attr("control")),g=j.attr("min")!=""?j.attr("min"):null,f=j.attr("max")!=""?j.attr("max"):null;this.element=h;if(h.length==0){alert('No control with id "'+j.attr("control")+'" can be found')}var j=j.wrap("<li/>").contents().unwrap().parents("li:first");this.validate=function(k){if(!k){j.show()}h.unbind("change",this.validate);if((g!=null&&h.val()<g)||(f!=null&&h.val()>f)){if(!k){h.addClass("Error").bind("change",this.validate)}return false}j.hide();h.removeClass("Error");return true}}}},d=function(f){f=f||a(document.body);f.find("input[default],textarea[default]").each(b.Default.each)};a(function(){a((document.all?"":"dmp\\:")+"validate").hide().each(function(){new c.Validators.Group(a(this))});a('img[popup="yes"]').live("mouseenter mouseleave mousedown",e.Popup.event);a("input[default],textarea[default]").each(b.Default.each).live("focus blur",b.Default.event);a("input[chars],textarea[chars]").live("keypress change",b.TextFilter.event);a("textarea[maxlength]").live("keypress input paste",b.TextArea.MaxLength.event);a("#PopupContent a.Close,#PopupBackground").live("click",c.Popup.close);if(e.Popup.el==null){a(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=a("#divPopup");e.Popup.img=a("#imgPopup")}});return{bind:d,Images:{preload:e.preload},Page:{refresh:c.refresh,popup:c.Popup.popup,complete:c.Popup.complete,error:c.Popup.error,close:c.Popup.close,Methods:c.Methods,Session:{Guid:c.Session.Guid},Validators:{Groups:c.Validators.list}}}}()})(jQuery);