(function(a){a.MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];
a.DAYSPERMONTH=[31,28,31,30,31,30,31,31,30,31,30,31];a.LONGWEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
a.SHORTWEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];a.getNumberOfDays=function(b){var d=b.getFullYear(),c=b.getMonth();
if(1==c&&((d%4==0&&d%100!=0)||d%400==0)){return 29;}else{return a.DAYSPERMONTH[c];
}};a.addMonths=function(b,c){var d=new Date(b);d.setMonth(b.getMonth()+c);
if(d.getDate()<b.getDate()){d.setDate(0);}return d;};a.fn.displayDate=function(b,d){var c=a.extend({months:a.MONTHS,weekdays:a.LONGWEEKDAYS},d||{});
a(this).html(c.weekdays[b.getDay()]+" "+c.months[b.getMonth()]+" "+b.getDate()+", "+b.getFullYear());
};a.formatDate=function(b,c){return(b.getMonth()+1)+"/"+b.getDate()+"/"+b.getFullYear();
};a.fn.displayTime=function(c,e){var b="am",d=c.getHours()%12,f;if(d==0){d=12;
}f=d+":";if(c.getHours()>11){b="pm";}if(c.getMinutes()<10){f+="0";}f+=c.getMinutes()+" "+b;
this.html(f);};a.isDate=function(b){if(isNaN(Date.parse(b))){return false;
}else{return true;}};})(jQuery);
if(typeof(console)==="undefined"){console={log:function(){return 5;}};}console.writeGlobals=function(){console.log("Globals");
for(var a in window){if(window.hasOwnProperty(a)){console.log(a);}}};
(function(a){a.fn.watch=function(e,d,f){if(!f){f=10;}return this.each(function(){var h=a(this),i=function(){c.call(this,h);
},g={props:e.split(","),func:d,vals:[]};a.each(g.props,function(j){g.vals[j]=h.css(g.props[j]);
});h.data(g);if(b()){h.bind("DOMAttrModified",d);}else{if(typeof(this.onpropertychange)=="object"){h.bind("propertychange",d);
}else{setInterval(i,f);}}});function c(j){var h=j.data(),g=false,l="";for(var k=0;
k<h.props.length;k++){l=j.css(h.props[k]);if(h.vals[k]!=l){h.vals[k]=l;g=true;
break;}}if(g&&h.func){h.func.call(j,h);}}};function b(){var e,d;d=false;e=document.createElement("p");
if(e.addEventListener){e.addEventListener("DOMAttrModified",c,false);}else{if(e.attachEvent){e.attachEvent("onDOMAttrModified",c);
}else{return false;}}e.setAttribute("id","target");return d;function c(){d=true;
}}})(jQuery);
(function(a){a.KEY={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};
})(jQuery);
RegExp.escape=function(a){return a.replace(/([.?*+^$[\]\\(){}-])/g,"\\$1");
};
(function(a){
/*
    * Cookie plugin
    *
    * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
    * Dual licensed under the MIT and GPL licenses:
    * http://www.opensource.org/licenses/mit-license.php
    * http://www.gnu.org/licenses/gpl.html
    *
    */
a.cookie=function(f,j,g){var h=function(o,l){var m,k,n;
if(o===null){o="";}if(l&&(typeof l=="number"||l.toUTCString)){var i;if(typeof l=="number"){i=new Date();
i.setTime(i.getTime()+(l*24*60*60*1000));}else{i=l;}l="; expires="+i.toUTCString();
}m=g.path?"; path="+(g.path):"";k=g.domain?"; domain="+(g.domain):"";n=g.secure?"; secure":"";
document.cookie=[f,"=",encodeURIComponent(o),l,m,k,n].join("");};if(typeof j!="undefined"){g=g||{};
if(j!==null){h(null,-1);h(j,g.expires);}else{h(null,-1);}}else{var d=null,e,c,b;
if(document.cookie&&document.cookie!=""){c=document.cookie.split(";");for(e=0;
e<c.length;e++){b=jQuery.trim(c[e]);if(b.substring(0,f.length+1)==(f+"=")){d=decodeURIComponent(b.substring(f.length+1));
break;}}}return d;}};})(jQuery);
(function(a){a.myAjax=function(f,c,g,b,e){var d=a.extend({type:"POST",data:"{}",contentType:"application/json; charset=utf-8",timeout:0,repeatFunction:null,repeatInterval:1000},e||{});
a.ajax({type:d.type,url:f+((c!=="")?("/"+c):""),data:d.data,contentType:d.contentType,converters:{"json jsond":function(h){if(h){return h.hasOwnProperty("d")?h.d:h;
}return null;}},dataType:"jsond",dataFilter:d.dataFilter,timeout:d.timeout,success:g,complete:function(h){if(d.repeatFunction!=null){setTimeout(d.repeatFunction,d.repeatInterval);
}},error:function(l,k,i){console.log("FAILURE",l,"TextStatus",k,"ErrorShrown",i);
var h=null,j;switch(k){case"error":j=l.responseText;if(j&&j.charAt(0)=="{"){h=(a.parseJSON(j)).d;
}if(h&&h.Redirect){window.location.href=h.Redirect+encodeURIComponent(window.location.pathname+window.location.search+window.location.hash)+"&sessionExpired=1";
}else{alert("Note: "+j);}break;case"timeout":h={Message:"Timeout"};break;default:h={Message:"Unkown error."};
}if(b){b(h);}}});};})(jQuery);
(function(a){a.formValidation=function(f,b,e,d,j){var g=a.extend({cssInvalid:"isInvalid",isPostBack:false,errorHeader:"Oops&hellip; we found issues with your information.",errorWrapper:'<div class="MessageError"><div><img src="/images/error-icon.png" width="48" height="48" /></div><h3>{ErrorHeader}</h3><ul>{ListItems}</ul></div>'},j||{}),h={required:function(n,m){if(a.trim(n.val())==m.defaultValue){return false;
}return true;},compare:function(n,m){if(a.trim(n.val())!=a.trim(a("#"+m.compareClientID).val())){return false;
}return true;},ischecked:function(m){if(!m.is(":checked")){return false;}return true;
},email:function(m){if(!(a.trim(m.val()).match(/\w+([\-+.']\w+)*@\w+([\-.]\w+)*\.\w+([\-.]\w+)*/))){return false;
}return true;},uszipcode:function(m){if(!(a.trim(m.val()).match(/\d{5}(-\d{4})?/))){return false;
}return true;},date:function(m){if(!(a.trim(m.val()).match(/(?=\d)^(?:(?!(?:10\D(?:0?[5-9]|1[0-4])\D(?:1582))|(?:0?9\D(?:0?[3-9]|1[0-3])\D(?:1752)))((?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)(?!-31)(?!\.31)|(?:0?2(?=.?(?:(?:29.(?!000[04]|(?:(?:1[^0-6]|[2468][^048]|[3579][^26])00))(?:(?:(?:\d\d)(?:[02468][048]|[13579][26])(?!\x20BC))|(?:00(?:42|3[0369]|2[147]|1[258]|09)\x20BC))))))|(?:0?2(?=.(?:(?:\d\D)|(?:[01]\d)|(?:2[0-8])))))([-.\/])(0?[1-9]|[12]\d|3[01])\2(?!0000)((?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?!\x20BC)))\d{4}(?:\x20BC)?)(?:$|(?=\x20\d)\x20))?((?:(?:0?[1-9]|1[012])(?::[0-5]\d){0,2}(?:\x20[aApP][mM]))|(?:[01]\d|2[0-3])(?::[0-5]\d){1,2})?$/))){return false;
}return true;},intrange:function(o,m){var n=a.trim(o.val());if(n===""){return true;
}if(!(n.match(/^[-]?\d+$/))){return false;}n=parseInt(n);if(n<m.minValue||n>m.maxValue){return false;
}return true;}},c=function(o){switch(d.DisplayMethod){case 1:if(o.length>0){alert(o.join("\n"));
}break;case 2:var n="";if(o.length>0){n=g.errorWrapper.replace(/{ListItems}/,"<li>"+o.join("</li><li>")+"</li>");
}a.displayMessage(d.CommaSeparatedSelectors,n);break;case 3:var m="";if(o.length>0){m=g.errorWrapper.replace(/{ListItems}/,"<li>"+o.join("</li><li>")+"</li>");
}a.showModal("group"+f,1,{html:m,anchorSelector:d.AnchorSelector,width:d.Width,popupHAlign:d.HAlign,popupVAlign:d.VAlign,popupOffsetLeft:d.OffsetLeft,popupOffsetTop:d.OffsetTop,showOverlay:false});
break;}},l=function(m){var o=[],p=false,q;for(q=0;q<m.length;q++){var n=m[q],r=0;
a(n.selector).each(function(t){var s=a(this).removeClass(g.cssInvalid),v;if(s.is(":visible")){for(v=0;
v<n.rules.length;v++){var w=n.rules[v],u=h[w.name].call(this,s,w);if(!u){if(r===0){o[o.length]=w.errorMessage;
}p=true;s.addClass(g.cssInvalid);r+=1;break;}}}});if(r>1){o[o.length-1]+=" ("+r+"x)";
}}if(!p){a.hideModal("group"+f);}return o;},k=function(){var m=l(g.elementsToValidate);
g.submitted=true;if(m.length>0){c(m);return false;}else{return true;}};g.elementsToValidate=e;
g.groupToValidate="";g.submitted=false;g.errorWrapper=g.errorWrapper.replace(/{ErrorHeader}/,g.errorHeader);
g.triggerValidation=function(){a(b).trigger("buttonClick");return g.returnValue;
};g.init=function(){var n;a("div#"+f+" .AJAXDATA").find(":text,:checkbox,:file,:password,:radio,select").bind("keypress",function(p){var o=(p.keyCode?p.keyCode:p.which);
if(o==13){a(b)[0].click();return false;}});for(i=0;i<g.elementsToValidate.length;
i++){var m=g.elementsToValidate[i];a(m.selector).each(function(o){a(this).bind("blur",{rules:m.rules},function(q){var p=a(this).removeClass(g.cssInvalid),s;
for(s=0;s<q.data.rules.length;s++){var r=h[q.data.rules[s].name].call(this,p,q.data.rules[s]);
if(!r){p.addClass(g.cssInvalid);}}if(d.DisplayMethod!=1&&(g.submitted||g.isPostBack)){n=l(g.elementsToValidate);
c(n);}});});}if(g.isPostBack){n=l(g.elementsToValidate);if(n.length>0){c(n);
}}};g.init();a(b).bind("buttonClick",function(m){g.returnValue=true;if(typeof this.href!=="undefined"){if(!k()){g.returnValue=false;
}}});a(b).click(function(m){a(this).trigger("buttonClick");return g.returnValue;
});a("form").bind("submit",function(m){return k();});return g;};})(jQuery);

(function(a){a.checkboxToText=function(b,c){a(b).hide().each(function(g){var e=a('<div style="cursor:pointer">Select</div>'),f=a('<div style="display:none;cursor:pointer">Selected</div>'),d=a(this);
d.after(e).after(f);e.bind("click",function(h){d.attr("checked",true);a(this).hide().parent().parent().css("background-color","green");
f.show();});f.bind("click",function(h){d.attr("checked",false);a(this).hide().parent().parent().css("background-color","transparent");
e.show();});});};})(jQuery);
(function(a){a.fn.spaceCellsEvenly=function(d){var c=a.extend({singeColumnWidth:200},d||{}),e,b;
b=this;b.bind("spaceCellsEvenly",function(g,f){e();});e=function(){var h=b.width(),g=Math.floor(h/c.singeColumnWidth),f=Math.floor(h/g);
b.css({width:h+"px"});b.find("div").css({width:f+"px"});};a(window).resize(function(){e();
});};})(jQuery);
(function(a){a.fn.linkDropdown=function(){return this.each(function(){var h=-1,g=false,c=a(this).bind("change.linkDropDown",function(j){i(c.val());
}).hide(),e=a('<a class="linkDropdown" href=""/>').insertAfter(c).click(function(j){var k=e.position();
b.css({top:(k.top+e.outerHeight())+"px",left:(k.left)+"px",width:"auto",overflow:"auto"}).show();
j.stopPropagation();return false;}),f=c.children("option").map(function(k,j){var l={Text:j.text,Value:j.value};
return l;}),b=a('<div class="linkDropdown"/>').hide().insertAfter(e).hover(function(){g=true;
},function(){g=false;}).append(function(){var k=[],j;k.push("<ul>");for(j=0;
j<f.length;j++){k.push("<li>"+f[j].Text+"</li>");}k.push("</ul>");return k.join("");
}()),i=function(j){h=a.map(f,function(l,k){if(l.Value==j){return k;}return null;
});d.removeClass("selected");e.html(f[h].Text);c.val(f[h].Value);d.eq(h).addClass("selected");
},d=b.find("li").each(function(j){a(this).bind("mouseover",{idx:j},function(k){d.removeClass("hover");
if(k.data.idx!==h){a(this).addClass("hover");}}).bind("mouseout",function(k){d.removeClass("hover");
}).bind("click",{idx:j},function(k){i(f[k.data.idx].Value);c.triggerHandler("change");
b.hide();});});a(document).mouseup(function(){if(!g){b.hide();}});i(c.val());
});};})(jQuery);
(function(a){a.downloadFile=function(f,d){var e="?",c,b=a("iframe[id=FILEDOWNLOAD]");
if(b.size()==0){b=a("<iframe>").attr("id","FILEDOWNLOAD").hide();a("body").append(b);
}for(c in d){f+=e+c+"="+encodeURIComponent(d[c]);e="&";}b.attr("src",f);};
})(jQuery);
(function(a){a.fn.stickyDiv=function(d){var g=a.extend({footerSelector:null},d||{}),c=this,e=c.position().top,b=g.footerSelector==null?null:a(g.footerSelector),f=function(){if(b&&(a(window).scrollTop()+c.height()+20)>b.position().top){c.css({position:"absolute",top:(b.position().top-c.height()-10)+"px"});
}else{if(a(window).scrollTop()>e){c.css({position:"fixed",top:"10px"});}else{c.css({position:"absolute",top:"auto"});
}}};a(window).scroll(function(){f();});f();};})(jQuery);
(function(a){a.fn.tabs=function(g){var e=this,h=[],d,b,c,f=false;Anmida.Tabs={activeTabName:"",changeTab:null};
d=e.find("ul.TABLIST li");d.each(function(k){var j=a(this);var l=j.find("a").attr("href").replace(/^#/,"");
h.push(l);j.bind("click.tab",{index:k,tabName:l},function(i){a.bbq.pushState({tab:i.data.tabName});
return false;});}).css("cursor","pointer");b=e.find("div[class=tabContent]");
c=b.find("> div");Anmida.Tabs.activeTabName=h[0];f=false;Anmida.Tabs.changeTab=function(){f=false;
c.each(function(j){if(Anmida.Tabs.activeTabName!==h[j]){d.eq(j).removeClass("current");
d.eq(j).removeClass("active");a(this).hide();}else{d.eq(j).addClass("current");
d.eq(j).addClass("active");a(this).show();f=true;}});if(!f){d.eq(0).addClass("current");
d.eq(0).addClass("active");c.eq(0).show();}};setTimeout(Anmida.Tabs.changeTab,200);
};a(window).bind("hashchange.tabs",function(b){a("#TABS").each(function(){var c=b.getState("tab")||Anmida.Tabs.activeTabName;
if(c!==Anmida.Tabs.activeTabName){Anmida.Tabs.activeTabName=c;Anmida.Tabs.changeTab();
}});});})(jQuery);
(function(a){a.fn.stars=function(){this.each(function(d){var b=a(this).hide(),c=a("<ul/>").addClass("stars"),e=b.is(":disabled");
b.after(c).find("option").each(function(g){var f;if(a(this).val()==0){if(!e){c.append(a('<li class="cancel"/>'));
}}else{f=a('<li class="star"/>').appendTo(c);if(!e){f.click({idx:g},function(i){var h=a(this);
h.nextAll().removeClass("star-sel");h.addClass("star-sel").prevAll(".star").addClass("star-sel");
b.val(i.data.idx);c.find("li.cancel").css("cursor","pointer").hover(function(){a(this).addClass("cancel-hover");
},function(){a(this).removeClass("cancel-hover");}).click(function(j){a(this).unbind("mouseenter mouseleave click").removeClass("cancel-hover").css("cursor","default").siblings().removeClass("star-sel");
b.val(0);});}).hover(function(){a(this).addClass("star-hover").prevAll(".star").addClass("star-hover");
},function(){a(this).removeClass("star-hover").siblings().removeClass("star-hover");
});if(g==b.val()){f.trigger("click");}}else{if(g<=b.val()){f.addClass("star-sel");
}f.addClass("readonly");}}});});return this;};})(jQuery);
(function(a){a.stateLoader=function(d,k,i){var h=a.extend({hasPleaseSelect:true,selectedValue:0},i||{}),j="stateLoader",f=true,c=a(k),l=function(n){c.empty();
if(h.hasPleaseSelect){c.append(a("<option></option>").val(0).html("- Please Select -"));
}for(var m=0;m<n.length;m++){c.append(a("<option></option>").val(n[m].StateID).html(n[m].Name));
}c.val(h.selectedValue);if(f==true){f=false;}else{a.hideModal(j);}},e=function(m){if(f==true){f=false;
}else{a.hideModal(j);}alert(m.Message);},b=a(d).bind("change",function(m){g();
}),g=function(){if(!f){a.showModal(j,2);}a.myAjax("/WS/Country.asmx","GetStatesByCountryID",l,e,{data:"{ 'countryID': '"+b.val()+"' }"});
}();};})(jQuery);
(function(a){Anmida.Comboboxes;a.fn.comboBox=function(k,s){var r=a.extend({selectedValue:-1,typeAhead:false,searchMode:1,allowNewEntry:false},s||{}),m,p,n,h,c,d,f,b,e,l=-1,q,t,u,j,g;
p=false;if(r.searchMode>1){r.typeAhead=false;}c=this.wrap('<div class="combobox" />');
d=a('<input autocomplete="off" title="- Please Select -" type="text"/>').insertAfter(c).bind("keydown.combobox",function(i){switch(i.which){case a.KEY.DOWN:q(1);
u();return;case a.KEY.UP:q(-1);u();return;break;}}).bind("keypress.combobox",function(o){var v;
if(o.keyCode===a.KEY.RETURN||o.keyCode===a.KEY.TAB){var w=-1;console.log("HOVER INDEX: "+l);
o.preventDefault();if(l>=0){w=j[l][0];}else{console.log("PRESS",d.val());for(v=0;
v<k.length;v++){if(d.val()===k[v][1]){w=k[v][0];break;}}}t(w);}}).bind("keyup.combobox",function(i){switch(i.which){case 16:return;
case a.KEY.DOWN:case a.KEY.UP:case a.KEY.RETURN:return;case a.KEY.BACKSPACE:c.val("");
n(true,false);u();break;case a.KEY.TAB:break;case a.KEY.ESC:b.hide();break;
default:n(false);u();}}).bind("focus.combobox",function(){p=true;u();}).bind("blur.combobox",function(){p=false;
});f=a('<span class="trigger"></span>').insertAfter(d);f.bind("mouseup.combobox",function(i){if(b.is(":visible")){b.hide();
}else{n(false,true);u();d.focus();}i.stopPropagation();return false;}).hover(function(){p=true;
f.addClass("hover");},function(){p=false;f.removeClass("hover");});b=a('<div class="dropdown"/>').hide().insertAfter(f).hover(function(){p=true;
},function(){p=false;});g=function(){if(!p){b.hide();}};console.log(this.attr("id"));
a(document).bind("mouseup."+this.attr("id"),{doStuff:g},function(i){console.log("mouseup");
i.data.doStuff();});n=function(i,v){var o,z=[],y,w="",x="";if(v){j=k;o="";
}else{o=RegExp.escape(d.val().toLowerCase());}switch(r.searchMode){case 1:x=new RegExp("("+o+")","i");
break;case 2:w=new RegExp("\\b("+o+")","gi");x=new RegExp("\\b("+o+")","gi");
break;case 3:x=new RegExp("("+o+")","gi");break;}j=a.map(k,function(B,A){switch(r.searchMode){case 1:if(B[1].toLowerCase().lastIndexOf(o,0)===0){B[2]=B[1].replace(x,"<strong>$1</strong>");
return[B];}break;case 2:if(o===""||w.test(B[1])){B[2]=B[1].replace(x,"<strong>$1</strong>");
return[B];}break;case 3:if(B[1].toLowerCase().indexOf(o)!=-1){B[2]=B[1].replace(x,"<strong>$1</strong>");
return[B];}break;}return null;});if(j.length===0){b.hide();return;}z.push("<ul>");
for(m=0;m<j.length;m++){z.push("<li"+(c.val()==j[m][0]?' class="selected"':"")+">"+(j[m][2]||j[m][1])+"</li>");
}z.push("</ul>");b.empty().append(z.join(""));e=b.find("li").each(function(A){a(this).bind("mouseover",{idx:A},function(B){e.removeClass("hover");
l=A;a(this).addClass("hover");}).bind("mouseout",function(B){e.removeClass("hover");
}).bind("click",{idx:A},function(B){t(j[B.data.idx][0]);b.hide();});});y=o.length;
if(y>0&&!i&&!v&&r.typeAhead){d.val(j[0][1]);h(d[0],y,d.val().length);}l=-1;
};q=function(x){var i,w,o,v;if(!j||j.length==0){return;}if(l<=0&&x<0){x=j.length-1;
}else{if(l>=(j.length-1)&&x>0){x=-(j.length-1);}}l+=x;e.removeClass("hover");
i=e.eq(l).addClass("hover").position().top||0;w=b.scrollTop();o=b.height();
v=e.eq(l).outerHeight();if(v+i>o){b.scrollTop(i+w+v-o);}else{if(i<0){b.scrollTop(i+w);
}}};u=function(){if(j.length===0){b.hide();return;}var i=d.position();b.css({top:(i.top+d.outerHeight())+"px",left:(i.left)+"px",width:(d.outerWidth()+17)+"px","max-height":"100px",overflow:"hidden","overflow-y":"auto"}).show();
};h=function(o,w,i){var v;if(o.createTextRange){v=o.createTextRange();v.collapse(true);
v.moveStart("character",w);v.moveEnd("character",i-w);v.select();}else{if(o.setSelectionRange){o.setSelectionRange(w,i);
}else{if(o.selectionStart){o.selectionStart=w;o.selectionEnd=i;}}}o.focus();
};t=function(w){var x=a.trim(d.val()),o=true,v;d.val("");c.val("");b.hide();
if(w>0){for(v=0;v<k.length;v++){if(w===k[v][0]){d.val(k[v][1]);c.val(k[v][0]);
o=false;break;}}}n(false);e.removeClass("selected");if(r.allowNewEntry&&o){if(x!==""){d.val(x);
c.val(0);}}d.blur();};j=k;t(r.selectedValue);d.watermark();return this;};})(jQuery);

(function(a){a.fn.watermark=function(){var b=[];this.each(function(d){var c=a(this);
b[d]=c.attr("title");c.attr("title","").bind("focus.watermark",{index:d},function(f){if(a.trim(c.val())===b[f.data.index]){c.val("").toggleClass("watermark");
}}).bind("blur.watermark",{index:d},function(f){if(a.trim(c.val())===""){c.val(b[d]).addClass("watermark");
}else{c.removeClass("watermark");}});if(a.trim(c.val())===""||c.val()===b[d]){c.val(b[d]).toggleClass("watermark");
}});return this;};})(jQuery);
(function(a){a.fn.calendar=function(b){this.each(function(){var n=a.extend({months:a.MONTHS,daysPerMonth:a.DAYSPERMONTH,weekdays:a.SHORTWEEKDAYS,firstDayOfWeek:0,pickerSelector:null,triggerCalendarOnTextBoxFocus:true,width:180,innerHeight:180},b||{});
if(n.pickerSelector!=null){n.$picker=a(n.pickerSelector).click(function(o){n.showCalendar();
return false;});}n.$dateInput=a(this);n.isAnimating=false;var m=1;n.today=new Date();
n.selectedDate=null;if(a.isDate(n.$dateInput.val())){n.selectedDate=new Date(n.$dateInput.val());
}var q=null;var s=null;var r=null;var t=null;var u=null;n.setWorkingDate=function(o){q=new Date().setDate(Date.parse(o));
s=o.getMonth();r=o.getDate();t=o.getDay();u=o.getFullYear();};n.animationDirection=1;
n.setWorkingDate(n.today);n.setDate=function(w,v,o){n.$dateInput.val((v+1)+"/"+o+"/"+w).trigger("change");
};n.createCellHandlers=function(o,x,w,v){if(n.today.getFullYear()==x&&n.today.getMonth()==w&&n.today.getDate()==v){o.addClass("todaysDate");
}if(n.selectedDate){if(n.selectedDate.getFullYear()==x&&n.selectedDate.getMonth()==w&&n.selectedDate.getDate()==v){o.addClass("selectedDate");
}}o.bind("click",{day:v,month:w,year:x},function(y){n.setDate(y.data.year,y.data.month,y.data.day);
n.hideCalendar();}).bind("mouseover mouseout",function(){a(this).toggleClass("hover");
}).css("cursor","pointer");return o;};n.showCalendar=function(){n.hideCalendar();
if(a.isDate(n.$dateInput.val())){n.selectedDate=new Date(n.$dateInput.val());
n.setWorkingDate(n.selectedDate);}else{n.setWorkingDate(n.today);}n.setTable(false);
n.setHeader(s,u);n.$popup.show().css({"z-index":1000,left:n.$dateInput.offset().left+"px",top:parseInt(n.$dateInput.offset().top+n.$dateInput.outerHeight())+"px"});
a(document).one("click."+this.id,function(o){n.hideCalendar();});};n.hideCalendar=function(){a("div.CALENDAR_POPUP").hide();
};n.setHeader=function(o,v){e.html("<strong>"+n.months[o]+" "+v+"</strong>");
};n.setTable=function(w){var I=r-(t-n.firstDayOfWeek);while(I>0){I-=7;}I=Math.abs(I)+1;
var J=a('<table class="calendarContent" cellpadding="0" cellspacing="5" width="'+n.width+'px"></table>');
var y=0;var L=a("<thead></thead>");var M=a("<tr/>");for(y=0;y<n.weekdays.length;
y++){M.append("<th>"+n.weekdays[y]+"</th>");}J.append(L.append(M));var H=1;
var K=a("<tbody/>");M=a("<tr/>");var E=s-1;var G=u;if(E<0){E=11;G-=1;}var A=s+1;
var C=u;if(A>11){A=0;C+=1;}var F=n.daysPerMonth[E]-(I-1);for(y=0;y<I;y++){M.append(n.createCellHandlers(a('<td class="otherMonth">'+(y+F)+"</td>"),G,E,y+F));
}var x=7-I;for(y=0;y<x;y++){M.append(n.createCellHandlers(a("<td>"+(y+1)+"</td>"),u,s,y+1));
}J.append(K.append(M));var D=n.daysPerMonth[s];var B=0;if(1==s&&((u%4==0&&u%100!=0)||u%400==0)){D=29;
}while(x<D){M=a("<tr/>");H+=1;var v=0;for(y=0;y<7&&x<D;y++){v+=1;x+=1;M.append(n.createCellHandlers(a("<td>"+x+"</td>"),u,s,x));
}if(v<7){for(y=v;y<7;y++){B+=1;M.append(n.createCellHandlers(a('<td class="otherMonth">'+(y-v+1)+"</td>"),C,A,(y-v+1)));
}}J.append(K.append(M));}if(H<6){M=a("<tr/>");for(y=0;y<7;y++){M.append(n.createCellHandlers(a('<td class="otherMonth">'+(B+y+1)+"</td>"),C,A,(B+y+1)));
}J.append(K.append(M));}if(!w){m=(m+1)%2;}var o=n["$innerContentDiv"+m];var z=n["$innerContentDiv"+(m+1)%2];
if(z.children().size()>0){z.css("position","static").css("zIndex",99);o.prependTo(c).css("position","absolute").css("backgroundColor","#fff").css("zIndex",100).html(J);
if(w){var N=o.width();n.isAnimating=true;o.css("left",n.animationDirection*(-N)).animate({left:"+="+(n.animationDirection*N)},150,"linear");
z.css("position","absolute").animate({left:"+="+(n.animationDirection*N)},150,"linear",function(){n.isAnimating=false;
});}else{}}else{o.prependTo(c).css("zIndex",100).html(J);}c.css("height",n.innerHeight+"px");
m=(m+1)%2;};n.$dateInput.focus(function(o){if(n.isAnimating){return;}n.showCalendar();
}).click(function(o){o.stopPropagation();});var j=a("<div/>");var f=a("<div/>");
var g=a('<table class="calendarHeader" cellpadding="0" cellspacing="0" width="100%"/>');
var h=a("<tr/>");var k=a("<td width='20px'/>").html('<img src="'+Anmida.AppFolder+'/images/calendar-previous.gif" alt=""/>').css("cursor","pointer").bind("click",function(o){if(n.isAnimating){return;
}n.animationDirection=1;s-=1;if(s<0){s=11;u-=1;}n.setWorkingDate(new Date(u,s,1));
n.setTable(true);n.setHeader(s,u);});var e=a("<td width='140px'/>").html(a("<a/>"));
var i=a("<td width='20px'/>").html('<img src="'+Anmida.AppFolder+'/images/calendar-next.gif" alt=""/>').css("cursor","pointer").bind("click",function(o){if(n.isAnimating){return;
}n.animationDirection=-1;s+=1;if(s>11){s=0;u+=1;}n.setWorkingDate(new Date(u,s,1));
n.setTable(true);n.setHeader(s,u);});f.append(g);g.append(h);h.append(k).append(e).append(i);
var c=a("<div/>").css("position","relative").css("width",n.width+"px").css("overflow","hidden");
n.$innerContentDiv0=a("<div/>");n.$innerContentDiv1=a("<div/>");c.append(n.$innerContentDiv0).append(n.$innerContentDiv1);
var p=new Date();var d=a("<div/>").addClass("calendarToday");var l=a("<a/>",{href:"#"}).html("Today: "+n.months[p.getMonth()]+", "+p.getDate()+" "+p.getFullYear()).bind("click",function(o){n.setDate(p.getFullYear(),p.getMonth(),p.getDate());
n.hideCalendar();return false;});d.append(l);j.append(f).append(c).append(d).addClass("calendar");
j.bind("click",function(o){o.stopPropagation();});n.$popup=a("<div/>").addClass("CALENDAR_POPUP").css("position","absolute").append(j).hide();
n.$dateInput.after(n.$popup);});};})(jQuery);
(function(a){a.fn.crudGrid=function(ad,at,K,J,L,ap,V,ai,ao,ag,P,X){var aw=0,ac=a(this).attr("id"),S=-1,H=a("#"+ac),u=H.find("#"+ac+"_msg"),p=H.find("li.NEW"),m=H.find("li.DELETE"),n=H.find("li.EDIT"),q=H.find("li.SAVE"),l=H.find("li.CANCEL"),r=H.find("li.SEARCH"),o=H.find("li.EXPORT"),D=H.find("th"),E=H.find("th.sort"),i=H.find("#"+ac+"_p_First"),y=H.find("#"+ac+"_p_Previous"),v=H.find("#"+ac+"_p_Next"),k=H.find("#"+ac+"_p_Last"),g=H.find("select[id="+ac+"_p_dropNumberOfResults]"),G=H.find("#"+ac+"_p_txtCurrentPage"),F=H.find("#"+ac+"_p_totalPages"),z=H.find(".DIV-SEARCH"),h=z.find("#"+ac+"_filter"),d=H.find("#"+ac+"__checkAll"),A=H.find(".AJAXDATA"),e=H.find("#"+ac+"_table"),j=H.find("#"+ac+"_dump"),f=H.find("span#"+ac+"_p_displayInfo"),x=a("#"+ac+"_p"),c=null,aq=true,B=e.find("tfoot"),C=B.find("td"),s=B.find(".ADDROW"),t=B.find(".REMOVEROW"),w=B.find(".NORECORDS"),U=null,Y=null,aj=[],ar=ap,O=true,W=V.pageSize,ak={},T="",ab=function(){return Math.ceil(ak.TotalRecords/V.pageSize);
},R=0,ax=ac+"_popup",M,aE,aA,au,aF,ay,b,aD,an,I,az,al,aB,ae,ah,aC=[],af,am,aa,Q,Z,av,N;
ak.OrderBy=[];N=function(){var aH,aG,aI;if(a.trim(V.sortOrder)!==""){aG=a.trim(V.sortOrder).split("|");
for(aH=0;aH<aG.length;aH++){aI=aG[aH].split("-");ak.OrderBy.push({ID:aI[0],SortType:aI[1]});
}}}();p.find("a").attr("href",at);M=function(aG,aI){var aH={};aH[aG]=aI;a.bbq.pushState(aH);
};z.find(".DATEPICKER").each(function(){a(this).calendar({pickerSelector:"#"+this.id+"-dp"});
});z.find(".DIVDROPDOWN").linkDropdown();if(ad==2){A.spaceCellsEvenly();}if(ao.AllowInsert){s.show().bind("click",function(aH){w.hide();
if(ag){D.first().show();C.attr("colspan",D.filter(":visible").size());}if(R<ao.MaxRows){R+=1;
var aG=a(ao.Markup);aG.find("input,select,textarea").each(function(aI){this.id+=-R;
});A.append(aG);an();ah();}if(R==ao.MaxRows){a(this).hide();}aB();if(R>0){t.show();
}else{t.hide();}am(true);return false;});t.bind("click",function(aH){var aG=A.find("tr[class=TR-NEW]:last");
if(aG.size()===1){aG.remove();R-=1;}s.show();if(R===0){aB();a(this).hide();
if(ag){D.first().hide();C.attr("colspan",D.filter(":visible").size());}}return false;
});}ay=function(){var aG;d.attr("checked",false);b.click(function(){this.checked=!this.checked;
}).each(function(){var aH=a(this),aI=aH.closest("tr"),aJ=aI.find("td").filter(function(aL){var aK=a(this);
if(aL===0){return true;}else{if(aK.has(":input,a").size()>0){return false;
}}return true;});aH.css("visibility","hidden");aJ.bind("mouseover",function(){var aK=a(this);
aK.css("cursor","pointer");if(aH.is(":checked")){return;}aI.addClass("hover");
aH.css("visibility","visible");}).bind("mouseout",function(){var aK=a(this);
if(aH.is(":checked")){return;}aI.removeClass("hover");aH.css("visibility","hidden");
});aJ.bind("click",function(){if(aH.is(":checked")){aH.css("visibility","visible");
aH.attr("checked",false);aI.removeClass("checked");}else{aH.attr("checked",true);
aI.addClass("checked");}aG();});});aG=function(){var aH=b.filter(":checked").size(),aI=b.size();
d.css("opacity",1);if(aH===aI){d.attr("checked",true);}else{if(aH===0){d.attr("checked",false);
}else{if(d.is(":checked")){d.css("opacity",0.5);}}}};d.bind("click",function(aH){if(a(this).is(":checked")){b.attr("checked",true).css("visibility","visible").closest("tr").addClass("checked");
}else{b.attr("checked",true).trigger("click").trigger("mouseout").closest("tr").removeClass("checked hover");
}aG();});};Q=function(){var aG=false;u.empty();c.each(function(aH){if(Z(a(this))){console.log(this.id+" change");
aG=true;}});if(aG){return confirm("Your changes have not been saved.\nDo you want to continue?");
}return true;};Z=function(aG){var aH=aa(aG);if(aH!=aG.data("init")){return true;
}return false;};av=function(){var aG,aH;for(aG=0;aG<ak.DropDowns.length;aG++){aH=ak.DropDowns[aG];
a("input[id^="+ac+"_"+aH.FieldCode+"_],select[id^="+ac+"_"+aH.FieldCode+"_]").each(function(aJ){var aK,aL,aI=a(this);
if(aI.attr("id").indexOf("_-")!==-1){return;}if(aH.Type==2){aI.comboBox(aH.Values);
}else{for(aK=0;aK<aH.Values.length;aK++){if((","+aH.ExcludedValues[aJ]+",").indexOf(","+aH.Values[aK][0]+",")==-1){aL="";
if((","+aH.SelectedValues[aJ]+",").indexOf(","+aH.Values[aK][0]+",")!=-1){aL=' selected="selected"';
}aI.append('<option value="'+aH.Values[aK][0]+'"'+aL+">"+aH.Values[aK][1]+"</option>");
}}aI.css("width:100%");}});}};au=function(){if(ad==2){H.find(".AJAXDATA>ul").dragsort({dragSelector:"img",dragEnd:aA});
}else{e.tableDnD({onDrop:function(aH,aG){},dragHandle:"DRAGHANDLE",onDragStyle:{"background-color":"gray"},onDropStyle:{"background-color":""}}).find("td.DRAGHANDLE").hover(function(){a(this).addClass("updown");
},function(){a(this).removeClass("updown");});}};aD=function(aG){aG.keyup(function(){if(Z(aG)){console.log(this.id+" change");
aG.css("background-color","red");}else{aG.css("background-color","white");
}});aG.data("init",aa(aG));};aF=function(){var aH=V.pageSize*S,aG=aH+parseInt(V.pageSize);
if(aG>ak.TotalRecords){aG=ak.TotalRecords;}F.html(ab());G.val(S+1);aH++;f.html("Displaying "+aH+" to "+aG+" of "+ak.TotalRecords+" items");
if(S==0){i.hide().next().show();y.hide().next().show();}else{i.show().next().hide();
y.show().next().hide();}if(S<(ab()-1)){v.show().next().hide();k.show().next().hide();
}else{k.hide().next().show();v.hide().next().show();}g.val(V.pageSize).triggerHandler("change.linkDropDown");
};aE=function(aG,aJ){var aH=[],aI=-100000;aG.each(function(){var aK=a(this),aL=aK.attr("id").split("_"),aN,aM=aL[1],aO="";
if(aL.length===4){aN=parseInt(aL[2]);aM+="_"+aL[3];}else{aN=parseInt(aL[aL.length-1]);
}if(aN!==aI){aI=aN;aH.push({idx:aN,hasChanged:0});}if(!aJ||(aK.is(":visible")||aK.attr("type")==="hidden")){aO=encodeURI(aa(aK));
}aH[aH.length-1][aM]=aO;if(Z(aK)){aH[aH.length-1].hasChanged=1;}});return JSON.stringify(aH);
};I=function(){var aH,aG;aH=function(aK){if(aw===8){U=null;aj=[];aw=0;a.downloadFile(aK.url,"");
a.hideModal(ax);return;}ak=aK.info;u.empty().hide();if(ak.Messages!=null&&ak.Messages.length>0){u.show();
for(var aJ=0;aJ<ak.Messages.length;aJ++){var aI="Message";switch(ak.Messages[aJ].MessageType){case 0:aI="MessageSuccess";
break;case 2:aI="MessageWarning";break;case 3:aI="MessageError";break;case 1:break;
}u.append('<div class="'+aI+'">'+ak.Messages[aJ].Text+"<div>").fadeIn(1000);
}}if(ak.HasErrors){a.hideModal(ax);return;}if(a.trim(aK.body)===""){w.show();
A.empty();}else{w.hide();A.html(aK.body);}ai=aK.hp;switch(aw){case 2:ar=ap;
R=0;break;case 3:R=0;break;case 4:R=0;break;case 5:ar=false;break;case 6:ar=true;
R=0;break;default:break;}H.show();ae();al();if(typeof(Anmida["val_"+ac])!=="undefined"){Anmida["val_"+ac].init();
}a.hideModal(ax);if(ad==2){A.triggerHandler("spaceCellsEvenly");}};aG=function(aI){a.hideModal(ax);
alert(aI.Message);if(aI.Message.indexOf("Validation Failed")>-1&&typeof(Anmida["val_"+ac])!=="undefined"){Anmida["val_"+ac].triggerValidation();
}};if(!aq){a.showModal(ax,2,{elementToOverlay:"#"+ac});aq=false;}a.myAjax("/GridCrudHandler.ashx","",aH,aG,{contentType:"application/x-www-form-urlencoded",data:{pageSize:V.pageSize,currentPage:S,orderBy:JSON.stringify(ak.OrderBy),hp:ai,op:aw,indexes:JSON.stringify(aj),data:U,filter:aE(z.find("input[type=text]:not(.ACTION), select"),false)}});
};az=function(){if(V.isChanged){a.myAjax("/GridSaveMemberSettings.ashx","",null,null,{repeatFunction:az,repeatInterval:2000,contentType:"application/x-www-form-urlencoded",data:{hp:ai,memberSettings:JSON.stringify(V)}});
V.isChanged=false;}else{setTimeout(az,2000);}};i.bind("click",function(){if(!Q()){return false;
}M(ac+"-P",0);return false;});y.bind("click",function(){if(!Q()){return false;
}M(ac+"-P",S-1);return false;});v.bind("click",function(){if(!Q()){return false;
}M(ac+"-P",S+1);return false;});k.bind("click",function(){if(!Q()){return false;
}M(ac+"-P",ab()-1);return false;});G.bind("blur",function(aI){var aG=a(this);
if(!Q()){aG.val(S+1);return false;}var aH=parseInt(aG.val());if(isNaN(aH)){aG.val(S+1);
aH=S+1;}else{if(aH>ab()){aH=ab();}else{if(aH<1){aH=1;}}aG.val(aH);}if(S!=aH-1){M(ac+"-P",aH-1);
}}).keyup(function(aG){if(aG.which===a.KEY.RETURN){g[0].focus();}});g.bind("change",function(){var aG=a(this),aH={};
if(!Q()){aG.val(V.pageSize);return false;}if(typeof(a.bbq.getState(ac+"-P"))!=="undefined"){aH[ac+"-P"]=0;
}if(V.pageSize!=aG.val()){V.pageSize=aG.val();V.isChanged=true;}aH[ac+"-N"]=aG.val();
a.bbq.pushState(aH);});q.click(function(aG){if(typeof(Anmida["val_"+ac])!=="undefined"&&Anmida["val_"+ac].triggerValidation()==false){return false;
}aw=2;U=aE(A.find("input:not(.ACTION), select, textarea").not(":disabled"),true);
I();return false;});aA=function(){var aG=H.find(".AJAXDATA>ul>li").map(function(){return a(this).attr("itemID");
}).get();aw=7;aG="[{ newIndexes : '"+aG+"' }]";I();};m.click(function(aG){var aH=[];
if(!Q()){return false;}b.filter(":checked").each(function(){aH.push(a(this).val());
});if(aH.length==0){alert("No records were selected.");return false;}if(confirm("Are you sure you want to delete the selected records?")){aw=3;
aj=aH;I();}return false;});n.click(function(aG){if(ar){if(R>0){j.empty().append(A.find("tr").slice(-(R)));
}aw=5;I();}else{}return false;});o.click(function(aG){if(!Q()){return false;
}aw=8;I();return false;});l.click(function(aG){aw=6;I();return false;});r.click(function(aG){if(z.is(":visible")){z.hide();
r.children().removeClass("search-open");V.filterOpen=false;}else{z.show();
r.children().addClass("search-open");V.filterOpen=true;}V.isChanged=true;return false;
});h.bind("click",function(){var aH="",aG;if(!Q()){return false;}z.find("input[type=text]:not(.ACTION), select").each(function(){var aI=a(this),aJ=aI.attr("id").split("_"),aK=parseInt(aJ[2]),aL;
if(aK!==aG){aG=aK;aH+=(aH===""?"":"_");}else{aH+="-";}if(this.tagName==="SELECT"&&aI.attr("multiple")==="multiple"){aL=aI.val();
if(aL!=null){aH+=encodeURI(aL.join("-"));}}else{aH+=encodeURI(a.trim(this.value));
}});M(ac+"-F",aH);S=0;I();return false;});af=function(){var aI,aG,aH;E.unbind().removeAttr("role").removeClass("sort selected").find("div").css("background-image","");
if(ak.VisibleRows>0){E.attr("role","link").addClass("sort").each(function(aK){var aJ=a(this);
aJ.bind("click",function(aL){var aN=false,aO,aM;if(!Q()){return false;}if(typeof(aL.metaKey==="undefined")){aL.metaKey=aL.ctrlKey;
}if(!aL.metaKey){if(ak.OrderBy.length==1&&a(this).data("sort")==ak.OrderBy[0]["ID"]){ak.OrderBy[0]["SortType"]=(ak.OrderBy[0]["SortType"]==1?0:1);
aN=true;}else{ak.OrderBy=[];}}else{if(ak.OrderBy.length>0){for(aM=0;aM<ak.OrderBy.length;
aM++){if(a(this).data("sort")==ak.OrderBy[aM]["ID"]){ak.OrderBy[aM]["SortType"]=(ak.OrderBy[aM]["SortType"]==1?0:1);
aN=true;}}}}if(!aN){ak.OrderBy.push({ID:a(this).data("sort"),SortType:0});
}S=0;aw=4;aO={};if(typeof(a.bbq.getState(ac+"-P"))!=="undefined"){aO[ac+"-P"]=0;
}aO[ac+"-S"]=function(){var aR="",aQ="",aP;for(aP=0;aP<ak.OrderBy.length;aP++){aQ+=aR+ak.OrderBy[aP]["ID"]+"-"+ak.OrderBy[aP]["SortType"];
aR="|";}return aQ;}();a.bbq.pushState(aO);return false;}).mouseover(function(){aJ.addClass("hover").find("> div").addClass("sort2");
}).mouseout(function(){aJ.removeClass("hover").find("> div").removeClass("sort2");
});});for(aI=0;aI<ak.OrderBy.length;aI++){aG=E.filter("[data-sort="+ak.OrderBy[aI]["ID"]+"]").addClass("selected");
aH=aG.find("div");if(ak.OrderBy[aI]["SortType"]===1){aH.css({"background-image":"url(/images/admin/table-sort/asc.gif)","background-position":"right center","background-repeat":"no-repeat"});
}else{aH.css({"background-image":"url(/images/admin/table-sort/desc.gif)","background-position":"right center","background-repeat":"no-repeat"});
}}}};al=function(){var aG,aH;if(aw>0){a(window).scrollTop(H.position().top-10);
}U=null;aj=[];aw=0;O=true;x.hide();t.hide();p.hide();n.hide();q.hide();l.hide();
m.hide();d.hide();av();if(ak.EditableRows==0&&ak.TotalRecords>0){ar=true;O=false;
}if(ak.ForceReadOnly==true){ar=true;}if(at!=""){p.show();}if(!ar){q.show();
}if(L&&ap&&ar&&O&&!ak.ForceReadOnly&&ak.VisibleRows>0){n.show();}if(ap&&!ar){l.show();
}if(J&&ak.DeleteFieldsCount>0){m.show();d.show();}if(ak.TotalRecords>0){x.show();
}if(ad==2){a.checkboxToText(".ACTION");}b=H.find("input[type=checkbox][class=ACTION]");
am(false);ay();aB();aF();D.show();for(aH=0;aH<ak.HideColumns.length;aH++){D.slice(ak.HideColumns[aH],ak.HideColumns[aH]+1).hide();
}if(ak.VisibleRows===0&&ao.DefaultRows==0&&ag){D.first().hide();C.attr("colspan",D.filter(":visible").size());
}af();au();c=A.find("input:not(.ACTION), select, textarea").each(function(){aD(a(this));
});A.find("input[type=checkbox]:not(.ACTION)").each(function(aI){a(this).parent().css("cursor","pointer").click(function(aJ){if(aJ.target.type!=="checkbox"){a("input:checkbox",this).trigger("click");
}});});aG=A.find("tr[class=TR-NEW]");for(aH=0;aH<ak.HideColumns.length;aH++){aG.each(function(aI){a(this).find("td").slice(ak.HideColumns[aH],ak.HideColumns[aH]+1).hide();
});}D.each(function(aJ){var aI=a(this),aK=aI.find("span").width();if(aI.width()<aK+15){aI.css("min-width",aK+15);
}});an();ah();E.css("height","23px");};an=function(){A.find("select.STARS").stars().removeClass("STARS");
};aa=function(aG){aH;var aH=a.trim(aG.val())||"";if(aG.attr("type")==="checkbox"||aG.attr("type")==="radio"){aH=aG.is(":checked")?1:0;
}else{if(aG.prop("tagName").toLowerCase()==="select"&&aG.attr("multiple")==="multiple"&&aG.val()!==null){aH=aG.val().join("|");
}}return aH;};am=function(aK){var aI,aL,aG,aJ,aH="";if(aK){aH="-";}for(aI=0;
aI<X.length;aI++){aG=X[aI];aJ="[id^="+ac+"_"+aG.p+"_"+aH+"]";A.find("input"+aJ+",select"+aJ).each(function(aM){a(this).off("change.dependency").on("change.dependency",function(aQ){var aP,aN,aO=a(this),aR;
for(aL=0;aL<aG.c.length;aL++){aP="[id^="+ac+"_"+aG.c[aL].c+"_]";aN=aO.closest("tr").find("input"+aP+",select"+aP+",textarea"+aP);
aR=aa(aO);if(typeof(aG.c[aL].v["v"+aR])!=="undefined"){aN.show();aN.val(aG.c[aL].v["v"+aR]);
}else{aN.hide();}}aO.data("old",aa(aO));console.log(aO.data());}).data("old",aa(a(this))).triggerHandler("change.dependency");
});}};aB=function(){if(R>0||!ar){q.show();}else{q.hide();}};ae=function(){if(ao.AllowInsert){var aH,aG;
if(j.children().size()>0){A.append(j.children());}else{for(aH=0;aH<ao.DefaultRows;
aH++){R+=1;aG=a(ao.Markup);aG.find("input,select,textarea").each(function(aI){this.id+=(-(aH+1));
});A.append(aG);an();}if(ao.DefaultRows<ao.MaxRows){s.show();}else{t.hide();
}}}if(ao.AllowInsert||ak.VisibleRows==0){B.show();}else{B.hide();}aB();};ah=function(){var aH,aG;
for(aH=0;aH<P.length;aH++){aG={};if(P[aH].width>0){aG.width=P[aH].width;}if(P[aH].maxDropHeight>0){aG.maxDropHeight=P[aH].maxDropHeight;
}aG.maxDropHeight=300;a(P[aH].selector).each(function(aJ){var aI=a(this);if(typeof(aI.data("wasInitialized"))==="undefined"){console.log(aG);
aI.dropdownchecklist(aG);aI.data("wasInitialized",true);}});}};this.handleHash=function(aK){var aG=ac,aI,aH,aO,aN,aL,aM,aP,aJ=false;
aI=parseInt(aK.getState(aG+"-P")||0);if(S!==aI){S=aI;aJ=true;}aO=parseInt(aK.getState(aG+"-N")||W);
if(V.pageSize!==aO){V.pageSize=aO;V.isChanged=true;aJ=true;}aN=aK.getState(aG+"-S")||"";
if(aN!==""&&ak.OrderBy.length==0){aL=aN.split("|");for(aM=0;aM<aL.length;aM++){aP=aL[aM].split("-");
ak.OrderBy.push({ID:aP[0],SortType:aP[1]});}}if(aN!=T){T=aN;V.sortOrder=T;
V.isChanged=true;aJ=true;}if(aJ){I();}};if(typeof(Anmida.GRIDS)==="undefined"){Anmida.GRIDS={};
}Anmida.GRIDS[ac]=this;az();};a(window).bind("hashchange.grids",function(b){a(".GRID").each(function(){var c=a(this).attr("id");
Anmida.GRIDS[c].handleHash(b);});});})(jQuery);
(function(a){a.logException=function(c,b){a.ajax({type:"POST",url:"/WS/ApplicationLog.asmx/LogException",data:"{ 'message': '"+c+"','stackTrace': '','source': '"+window.location.href+"','exceptionType': '"+b+"','additionalInfo' : ''}",contentType:"application/json; charset=utf-8"});
};a.hover=function(c){var b={};b.$Elements=a(c);b.$Elements.each(function(f){var d=a(this);
d.bind("mouseover mouseout",function(){a(this).toggleClass("andre-hover");
}).css("cursor","pointer");});};a.divSlider=function(c){var b=a.extend({classSelector:".DIVSLIDER"},c||{});
b.$sliderAnchors=a(b.classSelector).each(function(){var d=a("#div_"+this.id);
a(this).click(function(f){var g=a(this).children()[0];var h=parseInt(this.id.split("_")[1]);
d.slideToggle(1000,function(){var e=true;if(g.src.indexOf("down.png")>0){g.src=g.src.replace("down.png","up.png");
g.alt="Collapse";g.title="Collapse";}else{e=false;g.src=g.src.replace("up.png","down.png");
g.alt="Expand";g.title="Expand";}a.ajax({type:"POST",url:"/WS/NodeStatus.asmx/SaveNodeStatus",data:"{ 'nodeId':'"+h+"','expanded':'"+e+"'}",contentType:"application/json; charset=utf-8"});
});return false;});});};a.getSelectedText=function(b){return a(b+" :selected").text();
};a.geocodePositioning=function(e,b,d){var c=a.extend({tryInit:false},d||{});
c.$chkEnabled=a("#"+e+"_chkEnabled");c.$txtLongitude=a("#"+e+"_txtLongitude");
c.$txtLatitude=a("#"+e+"_txtLatitude");c.$spnLongitude=a("#"+e+"_spnLongitude");
c.$spnLatitude=a("#"+e+"_spnLatitude");c.$txtAccuracy=a("#"+e+"_txtAccuracy");
c.$divAccuracy=a("#"+e+"_divAccuracy");c.$divMapWrapper=a("#"+e+"_divMapWrapper");
c.$txtCenterLongitude=a("#"+e+"_txtCenterLongitude");c.$txtCenterLatitude=a("#"+e+"_txtCenterLatitude");
c.$txtZoomLevel=a("#"+e+"_txtZoomLevel");c.fullAddress="";c.$chkEnabled.change(function(){if(this.checked){c.$divMapWrapper.css("visibility","visible");
}else{c.$divMapWrapper.css("visibility","hidden");}}).trigger("change");c.$txtGeoCodeAddress=a("#"+e+"_txtGeoCodeAddress").blur(function(f){var g=a.trim(c.$txtGeoCodeAddress.val());
if(g===""){alert("Please enter your address information.");return;}if(c.fullAddress===g){return;
}c.fullAddress=g;c.geocoder=new google.maps.Geocoder();c.geocoder.geocode({address:c.fullAddress},function(l,m){if(m==google.maps.GeocoderStatus.OK){var k=l[0].geometry.location.lng();
var j=l[0].geometry.location.lat();b.clearMarkers();c.setUILatLng(j,k);var h=0;
switch(l[0].geometry.location_type){case"APPROXIMATE":h=1;break;case"GEOMETRIC_CENTER":h=2;
break;case"RANGE_INTERPOLATED":h=3;break;case"ROOFTOP":h=4;break;}c.setAccuracy(h);
c.addMarker(j,k,"","","",true);b.recenter();c.storeZoomAndCenter();}else{var i="";
if(m==google.maps.GeocoderStatus.ERROR){i="There was a problem contacting the Google servers.";
}else{if(m==google.maps.GeocoderStatus.INVALID_REQUEST){i="This GeocoderRequest was invalid.";
}else{if(m==google.maps.GeocoderStatus.OVER_QUERY_LIMIT){i="The webpage has gone over the requests limit in too short a period of time.";
}else{if(m==google.maps.GeocoderStatus.REQUEST_DENIED){i="The webpage is not allowed to use the geocoder.";
}else{if(m==google.maps.GeocoderStatus.UNKNOWN_ERROR){i="A geocoding request could not be processed due to a server error. The request may succeed if you try again.";
}else{if(m==google.maps.GeocoderStatus.ZERO_RESULTS){i="No result was found for this GeocoderRequest.";
}}}}}}a.logException(m+" "+i,"Google Maps");alert(i);}});});c.addMarker=function(i,j,l,f,h,g){var k=b.addMarkerToGoogleMap(i,j,l,f,h,g);
google.maps.event.addListener(k,"dragend",function(m){c.setUILatLng(m.latLng.lat(),m.latLng.lng());
c.setAccuracy(0);});};google.maps.event.addListener(b.googleMap,"mouseout",function(){c.storeZoomAndCenter();
});c.setUILatLng=function(f,g){c.$txtLongitude.val(g);c.$txtLatitude.val(f);
c.$spnLongitude.html(g);c.$spnLatitude.html(f);};c.storeZoomAndCenter=function(){c.$txtZoomLevel.val(b.getZoomLevel());
c.$txtCenterLongitude.val(b.getCenter().lng());c.$txtCenterLatitude.val(b.getCenter().lat());
};c.setAccuracy=function(f){c.$txtAccuracy.val(f);c.$divAccuracy.css("width",(parseInt(f)*100/4)+"%");
};if(c.tryInit){c.setUILatLng(c.$txtLatitude.val(),c.$txtLongitude.val());
b.setCenter(c.$txtCenterLatitude.val(),c.$txtCenterLongitude.val());b.setZoomLevel(parseInt(c.$txtZoomLevel.val()));
c.setAccuracy(c.$txtAccuracy.val());google.maps.event.addListenerOnce(b.googleMap,"tilesloaded",function(){c.addMarker(c.$txtLatitude.val(),c.$txtLongitude.val(),"","","",true);
});}};a.fn.grippie=function(d){var c=a.extend({minimumHeight:50,$dependent:null,dependentOffSet:0},d||{});
c.$document=a(document);c.$this=a(this);c.$grippie=a('<div class="grippie"></div>').mousedown(function(f){c.$this.css("opacity",0.3);
c.$document.bind("mouseup.grippie",function(g){e();}).bind("mousemove.grippie",b);
c.lastPos=f.pageY;});c.$this.after(c.$grippie);c.$grippie.css("width",c.$this.width());
function b(f){c.newPos=f.pageY;if(c.newPos<=20){e();}c.$this.css("height",Math.max(c.minimumHeight,parseInt(c.$this.height())+(c.newPos-c.lastPos))+"px");
if(c.$dependent!=null){c.$dependent.css("height",parseInt(c.$this.css("height"))+c.dependentOffSet+"px");
}c.lastPos=c.newPos;}a(window).resize(function(){c.$grippie.css("width",c.$this.width());
});function e(){c.$document.unbind("mousemove.grippie").unbind("mouseup.grippie");
c.$this.css("opacity",1).focus();}};a.mortgageCalculator=function(c){var b=a.extend({showAmortization:false},c||{});
b.$HomePrice=a("#MC_HomePrice");b.$DownPayment=a("#MC_DownPayment");b.$DownPaymentType=a("#MC_DownPaymentType");
b.$InterestRate=a("#MC_InterestRate");b.$Term=a("#MC_Term");b.$MonthlyPayment=a("#MC_MonthlyPayment");
b.$Currency=a("#MC_Currency");b.$spnLoanAmount=a("#MC_LoanAmount");b.principal=function(){var d=a.unformatNumber(b.$HomePrice.val());
if(b.$DownPaymentType.val()==0){d-=(b.$DownPayment.val()*d/100);}else{d-=a.unformatNumber(b.$DownPayment.val());
}return d;};b.calculate=function(){var f=12*b.$Term.val();var h=b.$InterestRate.val()/100/12;
var d=b.$Currency.val().split("-");var g=b.principal();var e=(h)/(1-Math.pow(1+h,-f))*g;
if(!isNaN(e)){b.$MonthlyPayment.html(d[1]+" "+a.formatNumber(e/d[0],2,true));
}else{b.$MonthlyPayment.html("");}if(!isNaN(g)){b.$spnLoanAmount.html(d[1]+" "+a.formatNumber(g/d[0],0,true));
}else{b.$spnLoanAmount.html("");}if(b.showAmortization){b.createAmortizationSchedule(e,f,g,h,d[0],d[2]);
}else{b.$lnkAmortization.attr("href",b.baseLink+"?mc-loanamount="+a.unformatNumber(b.$HomePrice.val())+"&mc-downpayment="+a.unformatNumber(b.$DownPayment.val())+"&mc_downpaymenttype="+b.$DownPaymentType.val()+"&mc-interestRate="+b.$InterestRate.val()+"&mc-term="+b.$Term.val()+"&mc-currency="+b.$Currency.val().split("-")[1]);
}};b.createAmortizationSchedule=function(j,l,o,k,e,f){var n=o;var w=0;var v=0;
var s=0;b.$divAmortization.empty();var u=0;var g=new Date(b.$LoanStartDate.val());
var h=g.getFullYear();var d=a('<table cellpadding="0" cellspacing="0" width="90%"><tr><th>Period</th><th>Date</th><th>Total Payment</th><th>Interest Paid</th><th>Principal Paid</th><th>Remaining Balance</th></tr></table>');
for(var r=1;r<=l;r++){var i=a.addMonths(g,r);if(h!=i.getFullYear()){if(r>1){u+=1;
d.append('<tr class="year-total"><td></td><td class="year">Year '+u+"</td><td>"+f+" "+a.formatNumber((v+w)/e,2,true)+"</td><td>"+f+" "+a.formatNumber(v/e,2,true)+"</td><td >"+f+" "+a.formatNumber(w/e,2,true)+'</td><td class="balance"></td></tr>');
w=0;v=0;}h=i.getFullYear();}var m=(1-((Math.pow(1+k,r)-1)/(Math.pow(1+k,l)-1)))*o;
var q=n-m;w+=q;v+=(j-q);s+=(j-q);d.append("<tr><td>"+r+"</td><td>"+a.formatDate(i)+"</td><td>"+f+" "+a.formatNumber(j/e,2,true)+"</td><td>"+f+" "+a.formatNumber((j-q)/e,2,true)+"</td><td>"+f+" "+a.formatNumber(q/e,2,true)+'</td><td class="balance">'+f+" "+a.formatNumber(m/e,2,true)+"</td></tr>");
n=m;}d.append('<tr class="year-total"><td></td><td class="year">Year '+(u+1)+"</td><td>"+f+" "+a.formatNumber((v+w)/e,2,true)+"</td><td>"+f+" "+a.formatNumber(v/e,2,true)+"</td><td>"+f+" "+a.formatNumber(w/e,2,true)+'</td><td class="balance"></td></tr>');
b.$divAmortization.html(d);b.$spnAmTotalInterest.html(f+" "+a.formatNumber(s/e,2,true));
b.$spnAmTotal.html(f+" "+a.formatNumber((s+o)/e,2,true));b.$spnsAmTerm.html(b.$Term.val());
};b.$HomePrice.focus(function(d){this.select();});b.$DownPayment.focus(function(d){this.select();
});b.$InterestRate.focus(function(d){this.select();});b.$Term.focus(function(d){this.select();
});b.$HomePrice.change(function(d){if(a.trim(b.$HomePrice.val())===""||isNaN(b.$HomePrice.val())){b.$HomePrice.addClass("isInvalid");
return;}b.$HomePrice.removeClass("isInvalid");b.calculate();b.$HomePrice.val(a.formatNumber(b.$HomePrice.val(),0,true));
});b.$DownPayment.change(function(d){if(a.trim(b.$DownPayment.val())===""||isNaN(b.$DownPayment.val())){b.$DownPayment.addClass("isInvalid");
return;}b.$DownPayment.removeClass("isInvalid");b.calculate();if(b.$DownPaymentType.val()==1){b.$DownPayment.val(a.formatNumber(b.$DownPayment.val(),0,true));
}});b.$DownPaymentType.change(function(d){if(b.$DownPaymentType.val()==0){b.$DownPayment.val(20);
}else{b.$DownPayment.val(a.formatNumber(20*a.unformatNumber(b.$HomePrice.val())/100,0,true));
}b.calculate();});b.$InterestRate.change(function(d){if(a.trim(b.$InterestRate.val())===""||isNaN(b.$InterestRate.val())){b.$InterestRate.addClass("isInvalid");
return;}b.$InterestRate.removeClass("isInvalid");b.calculate();});b.$Term.change(function(d){if(a.trim(b.$Term.val())===""||isNaN(b.$Term.val())){b.$Term.addClass("isInvalid");
return;}b.$Term.removeClass("isInvalid");b.calculate();});b.$Currency.change(function(d){b.calculate();
});if(b.showAmortization){b.$divAmortization=a("#MC_Amortization");b.$spnAmTotalInterest=a("#MC_Am_TotalInterest");
b.$spnsAmTerm=a(".MC_Am_Term");b.$spnAmTotal=a("#MC_Am_Total");b.$LoanStartDate=a("#MC_LoanStartDate").change(function(d){if(a.trim(b.$LoanStartDate.val())===""||!a.isDate(b.$LoanStartDate.val())){b.$LoanStartDate.addClass("isInvalid");
return;}b.$LoanStartDate.removeClass("isInvalid");b.calculate();});}else{b.$lnkAmortization=a("#MC_AmortizationLink");
b.baseLink=b.$lnkAmortization.attr("href");}b.calculate();};a.highlight=function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");
};a.viewport={width:function(){return a(window).width();},height:function(){return window.innerHeight?window.innerHeight:a(window).height();
}};a.timer=function(c,b){var d=setInterval(b,c*1000);return d;};a.clearTimer=function(b){window.clearInterval(b);
};a.getRandomNumber=function(d,c){var b=(parseFloat(c)-parseFloat(d))+1;return(Math.floor(Math.random()*b)+parseFloat(d));
};a.unitsLeft=function(g,b,c,h,e,d,f){var i={$selector:a(g),$timer:null,change:null};
i.change=function(){var j=a.getRandomNumber(e,d);if(j>0){c-=j;a.cookie(b,c,{expires:10,path:"/"});
if(c<f){a.clearTimer(i.$timer);}else{i.$selector.animate({fontSize:"1.2em"},500,function(){a(this).html(c).animate({fontSize:"1.0em"},500);
});}}};a.timer(h,i.change);};a.productDisplay=function(k,f,g,h,s,q,r,b,l,m,n,p,j,e){var d=a.extend({bgOff:"#fff",bgHover:"#dceec6",bgSelected:"#f7f1d8"},e||{});
d.imageBaseUrl=Anmida.AppFolder+"/images/";d.selectedIndex=-1;d.shippingAmount=0;
d.totalAmount=0;d.$spnShipping=a(l);d.$spnShippingLabel=a(j);d.$spnTotal=a(n);
d.$spnSubTotal=a(m);d.$txtSkuId=a(s);d.$txtProductShippingId=a(q);d.$txtShippingOptionId=a(r);
d.$selectImages=a("img[class=SELECT_IMAGE]").attr("src",d.imageBaseUrl+"select-off.png");
d.$submitButton=a(p).attr("src",d.imageBaseUrl+"submit-order-disabled.png").bind("click",function(i){if(d.selectedIndex===-1){alert("Please select a package first before placing your order.");
return false;}});d.$dropShipping=a(b).bind("change",function(i){d.calculateShipping();
});d.calculateShipping=function(){var t=k[d.selectedIndex];d.$spnShippingLabel.hide();
d.$dropShipping.show();var u=g[t];for(var o=0;o<u.length;o++){d.$dropShipping.get(0).options[o].text=h[o].Name+" $"+a.formatNumber(u[o].Amount,2,true)+" ";
if(d.$dropShipping.val()===u[o].ShippingOptionId){d.shippingAmount=u[o].Amount;
}}if(u.length==1){d.$dropShipping.hide();d.$spnShippingLabel.html(a.getSelectedText(b)).show();
}d.reDisplayTotals();};d.reDisplayTotals=function(){d.totalAmount=f[d.selectedIndex]+d.shippingAmount;
d.$spnSubTotal.html(a.formatNumber(f[d.selectedIndex],2,true));d.$spnShipping.html(a.formatNumber(d.shippingAmount,2,true));
d.$spnTotal.html(a.formatNumber(d.totalAmount,2,true));d.$txtSkuId.val(k[d.selectedIndex]);
d.$txtShippingOptionId.val(d.$dropShipping.val());for(var o=0;o<g[d.$txtSkuId.val()].length;
o++){if(g[d.$txtSkuId.val()][o].ShippingOptionId===d.$dropShipping.val()){d.$txtProductShippingId.val(g[d.$txtSkuId.val()][o].ProductShippingId);
}}};d.$allItems=a("tr[class=DISPLAY_ITEM]").each(function(i){a(this).bind("click",{index:i},function(o){if(o.data.index==d.selectedIndex){return;
}d.selectedIndex=o.data.index;d.calculateShipping();d.$submitButton.attr("src",d.imageBaseUrl+"submit-order.png");
d.$allItems.css("backgroundColor",d.bgOff);d.$selectImages.attr("src",d.imageBaseUrl+"select-off.png");
a(this).css("backgroundColor",d.bgSelected);d.$selectImages.slice(o.data.index,o.data.index+1).attr("src",d.imageBaseUrl+"select-selected.png");
}).bind("mouseover",{index:i},function(o){if(d.selectedIndex!=o.data.index){a(this).css({backgroundColor:d.bgHover,cursor:"pointer"});
d.$selectImages.slice(o.data.index,o.data.index+1).attr("src",d.imageBaseUrl+"select-on.png");
}}).bind("mouseout",{index:i},function(o){if(d.selectedIndex!=o.data.index){a(this).css({backgroundColor:d.bgOff});
d.$selectImages.slice(o.data.index,o.data.index+1).attr("src",d.imageBaseUrl+"select-off.png");
}});});if(d.$txtShippingOptionId.val()!==""){d.$dropShipping.val(d.$txtShippingOptionId.val());
}if(d.$txtSkuId.val()!==""){for(var c=0;c<k.length;c++){if(d.$txtSkuId.val()===k[c]){d.$allItems.slice(c,c+1).trigger("click");
}}}};a.crudGridServer=function(c,i,j,e,l,d,k,f,h){var g=function(){var m=c;
return m;};if(f!=""){a(f).bind("click",function(){var n="";var p="";for(var m=0;
m<h.length;m++){n+=p+a(h[m]).val();p="/";}var o=new RegExp("("+i+"=[0-9]*?_[0-9]*?_)([-A-Za-z0-9/]*)","g");
window.location.href=g().replace(o,"$1"+n);return false;});}a(e).bind("change",function(){var m=new RegExp("("+i+"=[0-9]*?_)([0-9]*?)(_)","g");
window.location.href=g().replace(m,"$1"+a(this).val()+"$3");});var b=a(l).bind("keypress",function(m){if(m.keyCode==a.KEY.RETURN){b.trigger("blur");
return false;}}).bind("blur",function(){var m=parseInt(b.val());if(isNaN(m)||m<1||m>(k)){b.val(d+1);
}else{var n=new RegExp("("+i+"=)([0-9]*?)(_)","g");window.location.href=g().replace(n,"$1"+(m-1)+"$3");
}});};a.crudForm=function(e,c,b,d,h,g,f,j){var i=a.extend({},j||{});i.hp=f;
i.op=0;i.prefix=e+"_";i.data=null;i.$wrapper=a("#"+e);i.$liNew=i.$wrapper.find("li.NEW");
i.$liDelete=i.$wrapper.find("li.DELETE");i.$liEdit=i.$wrapper.find("li.EDIT");
i.$liUpdate=i.$wrapper.find("li.UPDATE");i.$liInsert=i.$wrapper.find("li.INSERT");
i.$liCancel=i.$wrapper.find("li.CANCEL");i.$body=i.$wrapper.find("#"+i.prefix+"divContent");
i.isUpdate=h;i.isDefaultReadOnly=g;i.isReadOnly=i.isDefaultReadOnly;i.allowInsert=c;
i.allowDelete=b;i.init=function(){i.$liNew.hide();i.$liEdit.hide();i.$liUpdate.hide();
i.$liInsert.hide();i.$liCancel.hide();i.$liDelete.hide();if(i.isUpdate&&!i.isReadOnly){i.$liUpdate.show();
}if(i.isUpdate&&i.isDefaultReadOnly&&i.isReadOnly){i.$liEdit.show();}if(i.isUpdate&&i.isDefaultReadOnly&&!i.isReadOnly){i.$liCancel.show();
}if(i.isUpdate&&i.allowInsert){i.$liNew.show();}if(i.isUpdate&&i.allowDelete){i.$liDelete.show();
}if(!i.isUpdate){i.$liInsert.show();}i.$wrapper.find(".MAXLENGTH").each(function(){a.maxLengthIndicator("#"+this.id,"#"+this.id+"-c","#"+this.id+"-n");
});i.$wrapper.find(".GRIPPIE").each(function(){a(this).grippie();});i.$wrapper.find(".DATEPICKER").each(function(){a(this).calendar({pickerSelector:"#"+this.id+"-dp"});
});i.$wrapper.find(".HTML").each(function(){a(this).cleditor({width:"100%"});
a(this).parent().grippie({$dependent:a(this).next().add(a(this)),dependentOffSet:-27});
});i.$wrapper.find("a[id^="+i.prefix+"TT]").createToolTip();};i.popupID=e+"__popup";
i.$liEdit.click(function(k){if(i.isReadOnly){i.op=5;i.getFormBody();}else{alert("You are already editing this record.");
}return false;});i.$liCancel.click(function(k){i.op=6;i.getFormBody();return false;
});i.$liNew.click(function(k){i.op=7;i.getFormBody();return false;});i.upsert=function(){var k={hasValue:0};
i.$body.find("input:not(.ACTION), select, textarea").each(function(){var l=a(this);
var m=l.attr("id").split("_");var n=encodeURI(a.trim(this.value));if(l.attr("type")==="checkbox"||l.attr("type")==="radio"){n=l.is(":checked")?1:0;
k.hasValue=1;}else{if(this.tagName==="SELECT"){if(l.attr("multiple")===true){var o=l.val();
if(o!=null){if(o.length>0){k.hasValue=1;}n=o.join("|");}}else{if(parseInt(this.value)>0){k.hasValue=1;
}}}else{if(n!==""){k.hasValue=1;}}}k[m[1]]=n;});i.op=2;i.data=JSON.stringify(k).replace(/\+/g,"%2B");
i.getFormBody();};i.$liUpdate.click(function(k){i.upsert();return false;});
i.$liInsert.click(function(k){i.upsert();return false;});i.$liDelete.click(function(k){if(confirm("Are you sure you want to delete this record?")){i.op=3;
i.getFormBody();}return false;});i.getFormBody=function(){var m=function(o){if(typeof(o.redirectUrl)!=="undefined"){var n=o.redirectUrl.replace([self],window.location.href);
window.location.href=n;return;}i.$body.html(o.body);i.hp=o.hp;switch(i.op){case 2:i.isReadOnly=i.isDefaultReadOnly;
i.isUpdate=true;break;case 5:i.isReadOnly=false;break;case 6:i.isReadOnly=true;
break;case 7:i.isUpdate=false;i.isReadOnly=false;break;default:break;}i.init();
i.data=null;i.op=0;a.hideModal(i.popupID);};var k=function(n){a.hideModal(i.popupID);
alert(n.Message);};a.showModal(i.popupID,2,{elementToOverlay:"#"+e});var l=location.search.length>1?location.search.substring(1):"";
a.myAjax("/FormCrudHandler.ashx","",m,k,{contentType:"application/x-www-form-urlencoded",data:{op:i.op,hp:i.hp,data:i.data,queryString:encodeURIComponent(l)}});
};i.init();};a.slideShow=function(k,d,g){var i=a.extend({currentIndex:-1,width:750,height:500,delay:5000,transitionSpeed:2000},g||{});
var b=a("#"+k).css({height:i.height+"px",width:i.width+"px"});var f=false;
var h=function(){f=false;if(i.currentIndex>=(d.length-1)){i.currentIndex=0;
}else{i.currentIndex+=1;}a("<img />").load(function(){f=true;}).attr("src",d[i.currentIndex].imageUrl);
};var c=200;var l=1000;var e=true;var j=function(){if(f){var m=b.find("> div.active");
var o=b.find("> div:not(div.active)");var p=d[i.currentIndex];var n=a("<img />").attr({src:p.imageUrl,alt:""});
o.addClass("active").css({opacity:0}).html(n).animate({opacity:1},i.transitionSpeed);
if(p.navigateUrl&&p.navigateUrl!=""){n=n.wrap('<a href="'+p.navigateUrl+'"></a>');
}m.removeClass("active");if(e){b.find("div[id=divAjaxLoad]").hide();e=false;
}h();setTimeout(j,i.delay);}else{setTimeout(j,e?c:l);}};if(b.find("div.active").size()===0){b.find("div:first").addClass("active");
}h();setTimeout(j,c);};a.initExternalPopup=function(b,c){var d=a.extend({width:720,height:350,left:50,top:50},c||{});
a("#"+b).bind("click",function(){var e=window.open(this.href,this.id.replace(/\W/g,""),"height="+d.height+", width="+d.width+", scrollbars=1, resizable=1, left="+d.left+", top="+d.top);
e.focus();return false;});};a.showModal=function(m,q,k){var o=a.extend({anchorSelector:null,popupHAlign:2,popupVAlign:2,popupPosition:"absolute",popupOffsetLeft:0,popupOffsetTop:0,width:null,elementToOverlay:null,showOverlay:true,overlayColor:"#000",overlayOpacity:0.5,locked:false,fadeInSpeed:0,zIndexBase:100,html:"",htmlWait:'<div class="ajaxload"><span>Please Wait &hellip;</span></div>',htmlConfirm:'<h1>Confirm <a href="" onclick="$.hideModal(\''+m+"');return false;\" >Cancel</a></h1>"},k||{});
var r=o.zIndexBase;var c=a("body");if(o.showOverlay){var l="";if(o.elementToOverlay==null){l="position: fixed;top: 0px;left: 0px;height: 100%;width: 100%;background: "+o.overlayColor+";display:none";
}else{var d=a(o.elementToOverlay);var n=d.position();o.anchorSelector=o.elementToOverlay;
o.popupHAlign=2;o.popupVAlign=2,l="position: absolute;top:"+n.top+"px;left:"+n.left+"px;height:"+d.height()+"px;width:"+d.width()+"px;background: "+o.overlayColor+";display:none";
}var h=/^https/i.test(window.location.href||"")?"javascript:false":"about:blank";
var e=a('<iframe id="modal-overlay-iframe" style="'+l+";z-index:"+(r++)+';border:none;margin:0;padding:0;" src="'+h+'"></iframe>');
var f=a('<div id="modal-overlay" style="'+l+";z-index:"+(r++)+';"></div>');
c.append(e).append(f);e.css("opacity",0).show();f.css("opacity",o.overlayOpacity).fadeIn(o.fadeInSpeed);
}var g=a("#"+m);if(g.size()==0){g=a("<div></div>").attr("id",m);c.append(g);
}var b=null;if(o.anchorSelector==null){o.popupPosition="fixed";}else{b=a(o.anchorSelector);
if(b.size()===0){a.logException("No element was found for Anchor Selector "+o.anchorSelector,"WARNING");
b=null;o.popupPosition="fixed";o.popupHAlign=2;o.popupVAlign=2;}else{b.after(g);
}}g.css({margin:0,position:o.popupPosition});if(o.width){if(o.width.toString().indexOf("px")==-1){o.width+="px";
}g.css("width",o.width);}switch(q){case 1:g.html(o.html);break;case 2:g.html(o.htmlWait);
o.locked=true;break;case 3:g.html(o.htmlConfirm);o.locked=true;break;case 4:g.find("a.CLOSE").bind("click",function(s){a.hideModal(m);
return false;});break;}var i=0;var j=null;if(b!=null){j=b.offset();}switch(o.popupHAlign){case 0:i=(b==null)?0:parseInt(j.left-g.outerWidth());
break;case 1:i=(b==null)?0:parseInt(j.left);break;case 2:i=(b==null)?parseInt((a.viewport.width()-g.outerWidth())/2):parseInt(((b.outerWidth()-g.outerWidth())/2)+j.left);
break;case 3:i=(b==null)?(parseInt(a.viewport.width())-g.outerWidth()):parseInt(j.left+b.outerWidth()-g.outerWidth());
break;case 4:i=(b==null)?(parseInt(a.viewport.width())-g.outerWidth()):parseInt(j.left+b.outerWidth());
break;}i+=o.popupOffsetLeft;var p=0;switch(o.popupVAlign){case 0:p=(b==null)?0:parseInt(j.top-g.outerHeight());
break;case 1:p=(b==null)?0:parseInt(j.top);break;case 2:if(b==null){p=parseInt((a.viewport.height()-g.outerHeight())/2);
}else{p=parseInt(((b.outerHeight()-g.outerHeight())/2)+j.top);}break;case 3:p=(b==null)?(parseInt(a.viewport.height())-g.outerHeight()):parseInt(j.top+b.outerHeight()-g.outerHeight());
break;case 4:p=(b==null)?(parseInt(a.viewport.height())-g.outerHeight()):parseInt(j.top+b.outerHeight());
break;}p+=o.popupOffsetTop;g.css({"z-index":(r++),left:i+"px",top:(p<20?20:p)+"px"}).show();
if(!o.locked){a("#modal-overlay").bind("click.modalPopup",function(){a.hideModal(m);
});}};a.hideModal=function(b){a("#modal-overlay").unbind("click.modal").remove();
a("#modal-overlay-iframe").remove();a("#"+b).hide();};a.initCreditCardType=function(c){var b=a("#creditCardIcons img");
a(c).bind("keyup",function(f){b.each(function(e){this.src=this.src.replace("-on","-off");
});var d=a.getCreditCardType(a(this));switch(d){case 1:a("#visa").attr("src","/Images/visa-on.png");
break;case 2:a("#mastercard").attr("src","/Images/mastercard-on.png");break;
case 3:a("#discover").attr("src","/Images/discover-on.png");break;case 4:a("#amex").attr("src","/Images/amex-on.png");
break;}}).trigger("keyup");};a.getCreditCardType=function(b){var c=b.val();
if(c.match(/^4[0-9]{12}(?:[0-9]{3})?$/)){return 1;}else{if(c.match(/^5[1-5][0-9]{14}$/)){return 2;
}else{if(c.match(/^6(?:011|5[0-9]{2})[0-9]{12}$/)){return 3;}else{if(c.match(/^3[47][0-9]{13}$/)){return 4;
}}}}return 0;};a.showHide=function(b,g,e){var d=a.extend({enabledValue:0},e||{});
var c=function(h){if(a(g+":checked").val()==d.enabledValue){if(f.slideIn&&!h){a(b).slideDown(f.slideInSpeed);
}else{a(b).show();}}else{a(b).hide();}};var f=a.extend({slideIn:true,slideInSpeed:200},e||{});
c(true);a(g).bind("click",function(h){c(false);});};a.maxLengthIndicator=function(d,b,c){a(d).bind("keyup keydown",function(g){var f=a(this);
var h=f.val().length;if(h>c){f.val(f.val().substring(0,c));h=f.val().length;
}a(b).html(h);}).trigger("keyup");};a.highlightOnFocus=function(b){a(b).find("input[type=text],select,textarea").bind("focus",function(){a(this).addClass("hasFocus");
}).bind("blur",function(){a(this).removeClass("hasFocus");});};a.displayMessage=function(f,d){for(var c=0;
c<f.length;c++){var e=f[c];if(e.substring(0,1)!=="#"){e="#"+e;}var b=a(e);
if(b.size()>0){if(d.length>0){b.html(d).show();}else{b.hide();}break;}}};a.fontSizeController=function(g,h,j){var i="jFontSizeController";
var k=a.extend({currentIndex:3,minIndex:1,maxIndex:5,resizableTags:"p,h2,h3,h4,h5,li"},j||{});
var b=a(g).find(k.resizableTags);var f=function(l){k.currentIndex+=l;b.each(function(){var m=a(this);
var n=parseInt(a(this).css("font-size"))+(l*2);if(n<1){n=1;}m.css("font-size",n+"px");
});a.cookie(i,k.currentIndex,{expires:30});};if(a.cookie(i)&&(a.cookie(i)>=k.minIndex&&a.cookie(i)<=k.maxIndex)){f(parseInt(a.cookie(i))-k.currentIndex);
}var c=a(h);var e=c.find("a.increase").click(function(l){if(k.currentIndex<k.maxIndex){f(1);
}return false;});var d=c.find("a.decrease").click(function(l){if(k.currentIndex>k.minIndex){f(-1);
}return false;});};a.keepSessionAlive=function(c,d){var e=a.extend({numberOfTries:0},d||{});
var b=0;var f=a.timer(c,function(){if(e.numberOfTries===0||b<e.numberOfTries){a.myAjax("/WS/KeepSessionAlive.asmx","Request");
b+=1;}else{a.clearTimer(f);}});};a.setTimeZoneOffsetCookie=function(b){var c=new Date().getTimezoneOffset();
a.cookie(b,c,{expires:30,path:"/"});};a.fn.createToolTip=function(b,c){if(typeof(b)=="undefined"){b=15;
}if(typeof(c)=="undefined"){c=15;}return this.each(function(){a("#C"+this.id).hide();
a(this).bind("mousemove",function(d){var f=a("#C"+this.id);var g=d.pageX+b;
if(a(window).width()<g+f.width()){g=d.pageX-b-f.width();}f.css("left",g+"px").css("top",(d.pageY+c)+"px").show();
}).bind("mouseout",function(d){a("#C"+this.id).hide();}).bind("click",function(d){d.stopPropagation();
return false;});}).css("cursor","default");};a.formatNumber=function(c,b,e){if(isNaN(c)){return NaN;
}if(b==undefined){b=0;}c=parseFloat(c).toFixed(b);if(e){c+="";var f=c.split(".");
var g=f[0];var h=f.length>1?"."+f[1]:"";var d=/(\d+)(\d{3})/;while(d.test(g)){g=g.replace(d,"$1,$2");
}c=g+h;}return c;};a.unformatNumber=function(b){b=b.replace(",","");return b;
};a.fn.htmlEncode=function(){return this.each(function(){this.value=escape(this.value);
});};a.fn.htmlDecode=function(){return this.each(function(){this.value=unescape(this.value);
});};a.createMenu=function(b,c){var d=a.extend({timeout:500,dropdownOpacity:1},c||{});
d.timer=null;d.currentSubItem=null;d.close=function(){if(d.currentSubItem){d.currentSubItem.css("visibility","hidden");
}};a("#"+b+" > ul > li").bind("mouseover",function(){if(d.timer){window.clearTimeout(d.timer);
d.timer=null;}d.close();d.currentSubItem=a(this).find("ul").css({visibility:"visible",opacity:d.dropdownOpacity});
}).bind("mouseout",function(){d.timer=window.setTimeout(d.close,d.timeout);
});};a.gallery=function(g,b,e,d,f){var h=a.extend({showIndex:true,imgWidth:600,imgHeight:400},f||{});
h.currentIndex=e;h.$Title=b.find("#"+g+"_title");h.$Image=b.find("#"+g+"_img");
h.$Caption=b.find("#"+g+"_caption");h.$Index=b.find("#"+g+"_index");h.$CurrentPicture=b.find("#"+g+"_currentPicture");
b.find("#"+g+"_totalPictures").html(d.length);h.$NextImg=b.find("#"+g+"_nextImg");
h.$PreviousImg=b.find("#"+g+"_previousImg");h.$SpanPreviousImg=b.find("#"+g+"_spanPreviousImg");
h.$SpanNextImg=b.find("#"+g+"_spanNextImg");var c=function(j){h.currentIndex+=j;
h.$Title.html(d[h.currentIndex].Title);h.$Image.attr({src:d[h.currentIndex].ImageUrl});
var i=d[h.currentIndex].IsPortrait?h.imgWidth:h.imgHeight;var k=i==h.imgWidth?h.imgHeight:h.imgWidth;
h.$Image.parent().css({height:i+"px",width:k+"px"});h.$Caption.html(d[h.currentIndex].Caption);
if(!h.showIndex){h.$Index.css("display","none");}else{h.$CurrentPicture.html(h.currentIndex+1);
}if(h.currentIndex>=(d.length-1)){h.$NextImg.hide().removeAttr("href").unbind();
h.$SpanNextImg.show();}else{h.$SpanNextImg.hide();h.$NextImg.show().unbind().bind("click",function(l){c(1);
return false;}).attr("href","#");}if(h.currentIndex==0){h.$PreviousImg.hide().removeAttr("href").unbind();
h.$SpanPreviousImg.show();}else{h.$SpanPreviousImg.hide();h.$PreviousImg.show().unbind().bind("click",function(l){c(-1);
return false;}).attr("href","#");}a.hideModal(g);a.showModal(g,4,{width:h.width,showOverlay:true});
};c(0);};a.galleryPopup=function(f,g,b,e){var h=a.extend({imgWidth:600,imgHeight:400},e||{});
h.galleryWrapper=a("#"+f);var d=function(j,k){a(j).bind("click",{index:k},function(i){a.gallery(f,h.galleryWrapper,i.data.index,b,{imgWidth:h.imgWidth,imgHeight:h.imgHeight});
return false;});};for(var c=0;c<g.length;c++){a(g[c]).each(function(j){d(this,j);
});}};})(jQuery);

