(function(b){b.fn.extend({autocomplete:function(c,d){var i=typeof c=="string",d=b.extend({},b.Autocompleter.defaults,{url:i?c:null,data:i?null:c,delay:i?b.Autocompleter.defaults.delay:10,max:d&&!d.scroll?10:150},d);d.highlight=d.highlight||function(b){return b};d.formatMatch=d.formatMatch||d.formatItem;return this.each(function(){new b.Autocompleter(this,d)})},result:function(b){return this.bind("result",b)},search:function(b){return this.trigger("search",[b])},flushCache:function(){return this.trigger("flushCache")},
setOptions:function(b){return this.trigger("setOptions",[b])},unautocomplete:function(){return this.trigger("unautocomplete")}});b.Autocompleter=function(c,d){var i,h;function a(){var a=o.selected();if(!a)return!1;var e=a.result;n=e;if(d.multiple){var f=l(k.val());if(f.length>1){var j=d.multipleSeparator.length,h=b(c).selection().start,q,i=0;b.each(f,function(a,b){i+=b.length;if(h<=i)return q=a,!1;i+=j});f[q]=e;e=f.join(d.multipleSeparator)}e+=d.multipleSeparator}k.val(e);g();k.trigger("result",[a.data,
a.value]);return!0}function e(a,b){if(s==i)o.hide();else{var c=k.val();if(b||c!=n)n=c,c=j(c),c.length>=d.minChars?(k.addClass(d.loadingClass),d.matchCase||(c=c.toLowerCase()),p(c,f,g)):(k.removeClass(d.loadingClass),o.hide())}}function l(a){return!a?[""]:!d.multiple?[b.trim(a)]:b.map(a.split(d.multipleSeparator),function(c){return b.trim(a).length?b.trim(c):null})}function j(a){if(!d.multiple)return a;var e=l(a);if(e.length==1)return e[0];e=b(c).selection().start;e=e==a.length?l(a):l(a.replace(a.substring(e),
""));return e[e.length-1]}function g(){o.visible();o.hide();clearTimeout(r);k.removeClass(d.loadingClass);d.mustMatch&&k.search(function(a){a||(d.multiple?(a=l(k.val()).slice(0,-1),k.val(a.join(d.multipleSeparator)+(a.length?d.multipleSeparator:""))):(k.val(""),k.trigger("result",null)))})}function f(a,e){if(e&&e.length&&q){k.removeClass(d.loadingClass);o.display(e,a);var f=e[0].value;d.autoFill&&j(k.val()).toLowerCase()==a.toLowerCase()&&s!=h&&(k.val(k.val()+f.substring(j(n).length)),b(c).selection(n.length,
n.length+f.length));o.show()}else g()}function p(a,e,g){d.matchCase||(a=a.toLowerCase());var f=m.load(a);if(f&&f.length)e(a,f);else if(typeof d.url=="string"&&d.url.length>0){var q={timestamp:+new Date};b.each(d.extraParams,function(a,b){q[a]=typeof b=="function"?b():b});b.ajax({mode:"abort",port:"autocomplete"+c.name,dataType:d.dataType,url:d.url,data:b.extend({q:j(a),limit:d.max},q),success:function(c){var f;if(!(f=d.parse&&d.parse(c))){f=[];for(var c=c.split("\n"),g=0;g<c.length;g++){var j=b.trim(c[g]);
j&&(j=j.split("|"),f[f.length]={data:j,value:j[0],result:d.formatResult&&d.formatResult(j,j[0])||j[0]})}}m.add(a,f);e(a,f)}})}else o.emptyList(),g(a)}i=46;h=8;var k=b(c).attr("autocomplete","off").addClass(d.inputClass),r,n="",m=b.Autocompleter.Cache(d),q=0,s,u={mouseDownOnSelect:!1},o=b.Autocompleter.Select(d,c,a,u),t;b.browser.opera&&b(c.form).bind("submit.autocomplete",function(){if(t)return t=!1});k.bind((b.browser.opera?"keypress":"keydown")+".autocomplete",function(c){q=1;s=c.keyCode;switch(c.keyCode){case 38:c.preventDefault();
o.visible()?o.prev():e(0,!0);break;case 40:c.preventDefault();o.visible()?o.next():e(0,!0);break;case 33:c.preventDefault();o.visible()?o.pageUp():e(0,!0);break;case 34:c.preventDefault();o.visible()?o.pageDown():e(0,!0);break;case d.multiple&&b.trim(d.multipleSeparator)==","&&188:case 9:case 13:if(a())return c.preventDefault(),t=!0,!1;break;case 27:o.hide();break;default:clearTimeout(r),r=setTimeout(e,d.delay)}}).focus(function(){q++}).blur(function(){q=0;u.mouseDownOnSelect||(clearTimeout(r),r=
setTimeout(g,200))}).click(function(){q++>1&&!o.visible()&&e(0,!0)}).bind("search",function(){function a(b,e){var d;if(e&&e.length)for(var f=0;f<e.length;f++)if(e[f].result.toLowerCase()==b.toLowerCase()){d=e[f];break}typeof c=="function"?c(d):k.trigger("result",d&&[d.data,d.value])}var c=arguments.length>1?arguments[1]:null;b.each(l(k.val()),function(b,c){p(c,a,a)})}).bind("flushCache",function(){m.flush()}).bind("setOptions",function(a,c){b.extend(d,c);"data"in c&&m.populate()}).bind("unautocomplete",
function(){o.unbind();k.unbind();b(c.form).unbind(".autocomplete")})};b.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:!1,matchSubset:!0,matchContains:!1,cacheLength:10,max:100,mustMatch:!1,extraParams:{},selectFirst:!0,formatItem:function(b){return b[0]},formatMatch:null,autoFill:!1,width:0,multiple:!1,multipleSeparator:", ",highlight:function(b,d){return b.replace(RegExp("(?![^&;]+;)(?!<[^<>]*)("+d.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,
"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:!0,scrollHeight:180};b.Autocompleter.Cache=function(c){function d(a,b){c.matchCase||(a=a.toLowerCase());var e=a.indexOf(b);c.matchContains=="word"&&(e=a.toLowerCase().search("\\b"+b.toLowerCase()));return e==-1?!1:e==0||c.matchContains}function i(b,d){l>c.cacheLength&&a();e[b]||l++;e[b]=d}function h(){if(!c.data)return!1;var a={},e=0;if(!c.url)c.cacheLength=1;a[""]=[];for(var d=0,h=c.data.length;d<h;d++){var k=c.data[d],k=typeof k==
"string"?[k]:k,l=c.formatMatch(k,d+1,c.data.length);if(l!==!1){var n=l.charAt(0).toLowerCase();a[n]||(a[n]=[]);k={value:l,data:k,result:c.formatResult&&c.formatResult(k)||l};a[n].push(k);e++<c.max&&a[""].push(k)}}b.each(a,function(a,b){c.cacheLength++;i(a,b)})}function a(){e={};l=0}var e={},l=0;setTimeout(h,25);return{flush:a,add:i,populate:h,load:function(a){if(!c.cacheLength||!l)return null;if(!c.url&&c.matchContains){var g=[],f;for(f in e)if(f.length>0){var h=e[f];b.each(h,function(b,c){d(c.value,
a)&&g.push(c)})}return g}else if(e[a])return e[a];else if(c.matchSubset)for(f=a.length-1;f>=c.minChars;f--)if(h=e[a.substr(0,f)])return g=[],b.each(h,function(b,c){d(c.value,a)&&(g[g.length]=c)}),g;return null}}};b.Autocompleter.Select=function(c,d,i,h){var a;function e(){r&&(n=b("<div/>").hide().addClass(c.resultsClass).css("position","absolute").appendTo(document.body),m=b("<ul/>").appendTo(n).mouseover(function(c){l(c).nodeName&&l(c).nodeName.toUpperCase()=="LI"&&(f=b("li",m).removeClass(a).index(l(c)),
b(l(c)).addClass(a))}).click(function(c){b(l(c)).addClass(a);i();d.focus();return!1}).mousedown(function(){h.mouseDownOnSelect=!0}).mouseup(function(){h.mouseDownOnSelect=!1}),c.width>0&&n.css("width",c.width),r=!1)}function l(a){for(a=a.target;a&&a.tagName!="LI";)a=a.parentNode;return!a?[]:a}function j(b){g.slice(f,f+1).removeClass(a);f+=b;f<0?f=g.size()-1:f>=g.size()&&(f=0);b=g.slice(f,f+1).addClass(a);if(c.scroll){var e=0;g.slice(0,f).each(function(){e+=this.offsetHeight});e+b[0].offsetHeight-
m.scrollTop()>m[0].clientHeight?m.scrollTop(e+b[0].offsetHeight-m.innerHeight()):e<m.scrollTop()&&m.scrollTop(e)}}a="ac_over";var g,f=-1,p,k="",r=!0,n,m;return{display:function(d,h){e();p=d;k=h;m.empty();for(var l=c.max&&c.max<p.length?c.max:p.length,j=0;j<l;j++)if(p[j]){var i=c.formatItem(p[j].data,j+1,l,p[j].value,k);i!==!1&&(i=b("<li/>").html(c.highlight(i,k)).addClass(j%2==0?"ac_even":"ac_odd").appendTo(m)[0],b.data(i,"ac_data",p[j]))}g=m.find("li");c.selectFirst&&(g.slice(0,1).addClass(a),f=
0);b.fn.bgiframe&&m.bgiframe()},next:function(){j(1)},prev:function(){j(-1)},pageUp:function(){f!=0&&f-8<0?j(-f):j(-8)},pageDown:function(){f!=g.size()-1&&f+8>g.size()?j(g.size()-1-f):j(8)},hide:function(){n&&n.hide();g&&g.removeClass(a);f=-1},visible:function(){return n&&n.is(":visible")},current:function(){return this.visible()&&(g.filter("."+a)[0]||c.selectFirst&&g[0])},show:function(){var a=b(d).offset();n.css({width:typeof c.width=="string"||c.width>0?c.width:b(d).width(),top:a.top+d.offsetHeight,
left:a.left}).show();if(c.scroll&&(m.scrollTop(0),m.css({maxHeight:c.scrollHeight,overflow:"auto"}),b.browser.msie&&typeof document.body.style.maxHeight==="undefined")){var e=0;g.each(function(){e+=this.offsetHeight});a=e>c.scrollHeight;m.css("height",a?c.scrollHeight:e);a||g.width(m.width()-parseInt(g.css("padding-left"))-parseInt(g.css("padding-right")))}},selected:function(){var c=g&&g.filter("."+a).removeClass(a);return c&&c.length&&b.data(c[0],"ac_data")},emptyList:function(){m&&m.empty()},unbind:function(){n&&
n.remove()}}};b.fn.selection=function(b,d){if(b!==void 0)return this.each(function(){if(this.createTextRange){var a=this.createTextRange();d===void 0||b==d?a.move("character",b):(a.collapse(!0),a.moveStart("character",b),a.moveEnd("character",d));a.select()}else if(this.setSelectionRange)this.setSelectionRange(b,d);else if(this.selectionStart)this.selectionStart=b,this.selectionEnd=d});var i=this[0];if(i.createTextRange){var h=document.selection.createRange(),a=i.value,e=h.text.length;h.text="<->";
h=i.value.indexOf("<->");i.value=a;this.selection(h,h+e);return{start:h,end:h+e}}else if(i.selectionStart!==void 0)return{start:i.selectionStart,end:i.selectionEnd}}})(jQuery);jQuery.cookie=function(b,c,d){if(arguments.length>1&&String(c)!=="[object Object]"){d=jQuery.extend({},d);if(c===null||c===void 0)d.expires=-1;if(typeof d.expires==="number"){var i=d.expires,h=d.expires=new Date;h.setDate(h.getDate()+i)}c=String(c);return document.cookie=[encodeURIComponent(b),"=",d.raw?c:encodeURIComponent(c),d.expires?"; expires="+d.expires.toUTCString():"",d.path?"; path="+d.path:"",d.domain?"; domain="+d.domain:"",d.secure?"; secure":""].join("")}d=c||{};h=d.raw?function(a){return a}:
decodeURIComponent;return(i=RegExp("(?:^|; )"+encodeURIComponent(b)+"=([^;]*)").exec(document.cookie))?h(i[1]):null};(function(b){var c=b.browser.msie&&parseInt(b.browser.version)===6&&typeof window.XMLHttpRequest!=="object",d=b.browser.msie&&parseInt(b.browser.version)===7,i=null,h=[];b.modal=function(a,c){return b.modal.impl.init(a,c)};b.modal.close=function(){b.modal.impl.close()};b.modal.focus=function(a){b.modal.impl.focus(a)};b.modal.setContainerDimensions=function(){b.modal.impl.setContainerDimensions()};b.modal.setPosition=function(){b.modal.impl.setPosition()};b.modal.update=function(a,c){b.modal.impl.update(a,
c)};b.fn.modal=function(a){return b.modal.impl.init(this,a)};b.modal.defaults={appendTo:"body",focus:!0,opacity:20,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:!1,autoPosition:!0,zIndex:1E3,close:!0,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",escClose:!0,overlayClose:!1,position:null,persist:!1,modal:!0,
onOpen:null,onShow:null,onClose:null};b.modal.impl={d:{},init:function(a,c){if(this.d.data)return!1;i=b.browser.msie&&!b.boxModel;this.o=b.extend({},b.modal.defaults,c);this.zIndex=this.o.zIndex;this.occb=!1;if(typeof a==="object"){if(a=a instanceof jQuery?a:b(a),this.d.placeholder=!1,a.parent().parent().size()>0&&(a.before(b("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"})),this.d.placeholder=!0,this.display=a.css("display"),!this.o.persist))this.d.orig=a.clone(!0)}else if(typeof a===
"string"||typeof a==="number")a=b("<div></div>").html(a);else return alert("SimpleModal Error: Unsupported data type: "+typeof a),this;this.create(a);this.open();b.isFunction(this.o.onShow)&&this.o.onShow.apply(this,[this.d]);return this},create:function(a){h=this.getDimensions();if(this.o.modal&&c)this.d.iframe=b('<iframe src="javascript:false;"></iframe>').css(b.extend(this.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:h[0],width:h[1],zIndex:this.o.zIndex,top:0,left:0})).appendTo(this.o.appendTo);
this.d.overlay=b("<div></div>").attr("id",this.o.overlayId).addClass("simplemodal-overlay").css(b.extend(this.o.overlayCss,{display:"none",opacity:this.o.opacity/100,height:this.o.modal?h[0]:0,width:this.o.modal?h[1]:0,position:"fixed",left:0,top:0,zIndex:this.o.zIndex+1})).appendTo(this.o.appendTo);this.d.container=b("<div></div>").attr("id",this.o.containerId).addClass("simplemodal-container").css(b.extend(this.o.containerCss,{display:"none",position:"fixed",zIndex:this.o.zIndex+2})).append(this.o.close&&
this.o.closeHTML?b(this.o.closeHTML).addClass(this.o.closeClass):"").appendTo(this.o.appendTo);this.d.wrap=b("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(this.d.container);this.d.data=a.attr("id",a.attr("id")||this.o.dataId).addClass("simplemodal-data").css(b.extend(this.o.dataCss,{display:"none"})).appendTo("body");this.setContainerDimensions();this.d.data.appendTo(this.d.wrap);(c||i)&&this.fixIE()},bindEvents:function(){var a=
this;b("."+a.o.closeClass).bind("click.simplemodal",function(b){b.preventDefault();a.close()});a.o.modal&&a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(b){b.preventDefault();a.close()});b(document).bind("keydown.simplemodal",function(b){a.o.modal&&b.keyCode===9?a.watchTab(b):a.o.close&&a.o.escClose&&b.keyCode===27&&(b.preventDefault(),a.close())});b(window).bind("resize.simplemodal",function(){h=a.getDimensions();a.o.autoResize?a.setContainerDimensions():a.o.autoPosition&&
a.setPosition();c||i?a.fixIE():a.o.modal&&(a.d.iframe&&a.d.iframe.css({height:h[0],width:h[1]}),a.d.overlay.css({height:h[0],width:h[1]}))})},unbindEvents:function(){b("."+this.o.closeClass).unbind("click.simplemodal");b(document).unbind("keydown.simplemodal");b(window).unbind("resize.simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this.o.position;b.each([this.d.iframe||null,!this.o.modal?null:this.d.overlay,this.d.container],function(b,c){if(c){var d=c[0].style;d.position=
"absolute";if(b<2)d.removeExpression("height"),d.removeExpression("width"),d.setExpression("height",'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"'),d.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"');else{var g,f;a&&a.constructor===Array?(g=a[0]?typeof a[0]==="number"?a[0].toString():a[0].replace(/px/,""):c.css("top").replace(/px/,
""),g=g.indexOf("%")===-1?g+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"':parseInt(g.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',a[1]&&(f=typeof a[1]==="number"?a[1].toString():a[1].replace(/px/,""),f=f.indexOf("%")===-1?f+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':
parseInt(f.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"')):(g='(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',f='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"');
d.removeExpression("top");d.removeExpression("left");d.setExpression("top",g);d.setExpression("left",f)}}})},focus:function(a){var c=this,a=a&&b.inArray(a,["first","last"])!==-1?a:"first",d=b(":input:enabled:visible:"+a,c.d.wrap);setTimeout(function(){d.length>0?d.focus():c.d.wrap.focus()},10)},getDimensions:function(){var a=b(window);return[b.browser.opera&&b.browser.version>"9.5"&&b.fn.jquery<"1.3"||b.browser.opera&&b.browser.version<"9.5"&&b.fn.jquery>"1.2.6"?a[0].innerHeight:a.height(),a.width()]},
getVal:function(a,b){return a?typeof a==="number"?a:a==="auto"?0:a.indexOf("%")>0?parseInt(a.replace(/%/,""))/100*(b==="h"?h[0]:h[1]):parseInt(a.replace(/px/,"")):null},update:function(a,b){if(!this.d.data)return!1;this.d.origHeight=this.getVal(a,"h");this.d.origWidth=this.getVal(b,"w");this.d.data.hide();a&&this.d.container.css("height",a);b&&this.d.container.css("width",b);this.setContainerDimensions();this.d.data.show();this.o.focus&&this.focus();this.unbindEvents();this.bindEvents()},setContainerDimensions:function(){var a=
c||d,e=this.d.origHeight?this.d.origHeight:b.browser.opera?this.d.container.height():this.getVal(a?this.d.container[0].currentStyle.height:this.d.container.css("height"),"h"),a=this.d.origWidth?this.d.origWidth:b.browser.opera?this.d.container.width():this.getVal(a?this.d.container[0].currentStyle.width:this.d.container.css("width"),"w"),i=this.d.data.outerHeight(!0),j=this.d.data.outerWidth(!0);this.d.origHeight=this.d.origHeight||e;this.d.origWidth=this.d.origWidth||a;var g=this.o.maxHeight?this.getVal(this.o.maxHeight,
"h"):null,f=this.o.maxWidth?this.getVal(this.o.maxWidth,"w"):null,g=g&&g<h[0]?g:h[0],f=f&&f<h[1]?f:h[1],p=this.o.minHeight?this.getVal(this.o.minHeight,"h"):"auto",e=e?this.o.autoResize&&e>g?g:e<p?p:e:i?i>g?g:this.o.minHeight&&p!=="auto"&&i<p?p:i:p,g=this.o.minWidth?this.getVal(this.o.minWidth,"w"):"auto",a=a?this.o.autoResize&&a>f?f:a<g?g:a:j?j>f?f:this.o.minWidth&&g!=="auto"&&j<g?g:j:g;this.d.container.css({height:e,width:a});this.d.wrap.css({overflow:i>e||j>a?"auto":"visible"});this.o.autoPosition&&
this.setPosition()},setPosition:function(){var a,b;a=h[0]/2-this.d.container.outerHeight(!0)/2;b=h[1]/2-this.d.container.outerWidth(!0)/2;this.o.position&&Object.prototype.toString.call(this.o.position)==="[object Array]"&&(a=this.o.position[0]||a,b=this.o.position[1]||b);this.d.container.css({left:b,top:a})},watchTab:function(a){if(b(a.target).parents(".simplemodal-container").length>0){if(this.inputs=b(":input:enabled:visible:first, :input:enabled:visible:last",this.d.data[0]),!a.shiftKey&&a.target===
this.inputs[this.inputs.length-1]||a.shiftKey&&a.target===this.inputs[0]||this.inputs.length===0)a.preventDefault(),this.focus(a.shiftKey?"last":"first")}else a.preventDefault(),this.focus()},open:function(){this.d.iframe&&this.d.iframe.show();b.isFunction(this.o.onOpen)?this.o.onOpen.apply(this,[this.d]):(this.d.overlay.show(),this.d.container.show(),this.d.data.show());this.o.focus&&this.focus();this.bindEvents()},close:function(){var a=this;if(!a.d.data)return!1;a.unbindEvents();if(b.isFunction(a.o.onClose)&&
!a.occb)a.occb=!0,a.o.onClose.apply(a,[a.d]);else{if(a.d.placeholder){var c=b("#simplemodal-placeholder");a.o.persist?c.replaceWith(a.d.data.removeClass("simplemodal-data").css("display",a.display)):(a.d.data.hide().remove(),c.replaceWith(a.d.orig))}else a.d.data.hide().remove();a.d.container.hide().remove();a.d.overlay.hide();a.d.iframe&&a.d.iframe.hide().remove();setTimeout(function(){a.d.overlay.remove();a.d={}},10)}}}})(jQuery);

