daily pastebin goal
8%
SHARE
TWEET

http://static.foody.vn/Scripts/public.core.min.js_part2

canhnm Feb 27th, 2014 241 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(a){a.fn.extend({dropdown:function(){return getSelectedValue=function(b){return a("#"+b).find("dt a span.value").html()},a(document).bind("click",function(b){var c=a(b.target);c.parents("dl").data("dropdown")!="true"&&a("dd ul").hide()}),this.each(function(){var b=this;a(document).height()<=a(b).offset().top+315&&a("dd",b).css("bottom","10px"),a(b).data("dropdown","true"),a("dt a",b).click(function(){a("dd ul",b).toggle()})})}})})(jQuery)
  2. ;var scrolltotop={setting:{startline:100,scrollto:0,scrollduration:0,fadeduration:[500,100]},controlHTML:'<img src="http://static.foody.vn/Scripts/scroll/go-top.png" style="width:59px; height:50px" />',controlattrs:{offsetx:0,offsety:0},anchorkeyword:"#top",state:{isvisible:!1,shouldvisible:!1},scrollup:function(){this.cssfixedsupport||this.$control.css({opacity:0});var a=isNaN(this.setting.scrollto)?this.setting.scrollto:parseInt(this.setting.scrollto);typeof a=="string"&&jQuery("#"+a).length==1?a=jQuery("#"+a).offset().top:a=0,this.$body.animate({scrollTop:a},this.setting.scrollduration)},keepfixed:function(){var a=jQuery(window),b=a.scrollLeft()+a.width()-this.$control.width()-this.controlattrs.offsetx,c=a.scrollTop()+a.height()-this.$control.height()-this.controlattrs.offsety;this.$control.css({left:b+"px",top:c+"px"})},togglecontrol:function(){var a=jQuery(window).scrollTop();this.cssfixedsupport||this.keepfixed(),this.state.shouldvisible=a>=this.setting.startline?!0:!1,this.state.shouldvisible&&!this.state.isvisible?(this.$control.stop().animate({opacity:1},this.setting.fadeduration[0]),this.state.isvisible=!0):this.state.shouldvisible==0&&this.state.isvisible&&(this.$control.stop().animate({opacity:0},this.setting.fadeduration[1]),this.state.isvisible=!1)},init:function(){jQuery(document).ready(function(a){var b=scrolltotop,c=document.all;b.cssfixedsupport=!c||c&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest,b.$body=window.opera?document.compatMode=="CSS1Compat"?a("html"):a("body"):a("html,body"),b.$control=a('<div id="topcontrol">'+b.controlHTML+"</div>").css({position:b.cssfixedsupport?"fixed":"absolute",bottom:b.controlattrs.offsety,right:b.controlattrs.offsetx,opacity:0,cursor:"pointer"}).attr({title:"Back to Top"}).click(function(){return b.scrollup(),!1}).appendTo("body"),document.all&&!window.XMLHttpRequest&&b.$control.text()!=""&&b.$control.css({width:b.$control.width()}),b.togglecontrol(),a('a[href="'+b.anchorkeyword+'"]').click(function(){return b.scrollup(),!1}),a(window).bind("scroll resize",function(a){b.togglecontrol()})})}};scrolltotop.init()
  3. ;(function(a,b,c){(function(a){"use strict",typeof define=="function"&&define.amd?define(["jquery"],a):jQuery&&!jQuery.fn.qtip&&a(jQuery)})(function(d){function I(a){var b=function(a){return a===g||"object"!=typeof a},c=function(a){return!d.isFunction(a)&&(!a&&!a.attr||a.length<1||"object"==typeof a&&!a.jquery)};if(!a||"object"!=typeof a)return f;b(a.metadata)&&(a.metadata={type:a.metadata});if("content"in a){if(b(a.content)||a.content.jquery)a.content={text:a.content};c(a.content.text||f)&&(a.content.text=f),"title"in a.content&&(b(a.content.title)&&(a.content.title={text:a.content.title}),c(a.content.title.text||f)&&(a.content.title.text=f))}return"position"in a&&b(a.position)&&(a.position={my:a.position,at:a.position}),"show"in a&&b(a.show)&&(a.show=a.show.jquery?{target:a.show}:{event:a.show}),"hide"in a&&b(a.hide)&&(a.hide=a.hide.jquery?{target:a.hide}:{event:a.hide}),"style"in a&&b(a.style)&&(a.style={classes:a.style}),d.each(u,function(){this.sanitize&&this.sanitize(a)}),a}function J(h,i,q,r){function Q(a){var b=0,c,d=i,e=a.split(".");while(d=d[e[b++]])b<e.length&&(c=d);return[c||i,e.pop()]}function R(a,b,c){var e=d.Event("tooltip"+a);return e.originalEvent=(c?d.extend({},c):g)||P.event||g,M.trigger(e,[s].concat(b||[])),!e.isDefaultPrevented()}function S(){var a=i.style.widget;M.toggleClass("ui-helper-reset "+y,a).toggleClass(B,i.style.def&&!a),O.content&&O.content.toggleClass(y+"-content",a),O.titlebar&&O.titlebar.toggleClass(y+"-header",a),O.button&&O.button.toggleClass(x+"-icon",!a)}function T(a){O.title&&(O.titlebar.remove(),O.titlebar=O.title=O.button=g,a!==f&&s.reposition())}function U(){var a=i.content.title.button,b=typeof a=="string",c=b?a:"Close tooltip";O.button&&O.button.remove(),a.jquery?O.button=a:O.button=d("<a />",{"class":"ui-state-default ui-tooltip-close "+(i.style.widget?"":x+"-icon"),title:c,"aria-label":c}).prepend(d("<span />",{"class":"ui-icon ui-icon-close",html:"&times;"})),O.button.appendTo(O.titlebar).attr("role","button").click(function(a){return M.hasClass(z)||s.hide(a),f}),s.redraw()}function V(){var a=J+"-title";O.titlebar&&T(),O.titlebar=d("<div />",{"class":x+"-titlebar "+(i.style.widget?"ui-widget-header":"")}).append(O.title=d("<div />",{id:a,"class":x+"-title","aria-atomic":e})).insertBefore(O.content).delegate(".ui-tooltip-close","mousedown keydown mouseup keyup mouseout",function(a){d(this).toggleClass("ui-state-active ui-state-focus",a.type.substr(-4)==="down")}).delegate(".ui-tooltip-close","mouseover mouseout",function(a){d(this).toggleClass("ui-state-hover",a.type==="mouseover")}),i.content.title.button?U():s.rendered&&s.redraw()}function W(a){var b=O.button,c=O.title;if(!s.rendered)return f;a?(c||V(),U()):b.remove()}function X(a,b){var c=O.title;if(!s.rendered||!a)return f;d.isFunction(a)&&(a=a.call(h,P.event,s));if(a===f||!a&&a!=="")return T(f);a.jquery&&a.length>0?c.empty().append(a.css({display:"block"})):c.html(a),s.redraw(),b!==f&&s.rendered&&M[0].offsetWidth>0&&s.reposition(P.event)}function Y(a,b){function g(a){function i(c){c&&(delete h[c.src],clearTimeout(s.timers.img[c.src]),d(c).unbind(N)),d.isEmptyObject(h)&&(s.redraw(),b!==f&&s.reposition(P.event),a())}var g,h={};if((g=e.find("img[src]:not([height]):not([width])")).length===0)return i();g.each(function(a,b){if(h[b.src]!==c)return;var e=0,f=3;(function g(){if(b.height||b.width||e>f)return i(b);e+=1,s.timers.img[b.src]=setTimeout(g,700)})(),d(b).bind("error"+N+" load"+N,function(){i(this)}),h[b.src]=b})}var e=O.content;return!s.rendered||!a?f:(d.isFunction(a)&&(a=a.call(h,P.event,s)||""),a.jquery&&a.length>0?e.empty().append(a.css({display:"block"})):e.html(a),s.rendered<0?M.queue("fx",g):(L=0,g(d.noop)),s)}function Z(){function l(a){if(M.hasClass(z))return f;clearTimeout(s.timers.show),clearTimeout(s.timers.hide);var b=function(){s.toggle(e,a)};i.show.delay>0?s.timers.show=setTimeout(b,i.show.delay):b()}function m(a){if(M.hasClass(z)||K||L)return f;var b=d(a.relatedTarget||a.target),e=b.closest(A)[0]===M[0],h=b[0]===g.show[0];clearTimeout(s.timers.show),clearTimeout(s.timers.hide);if(c.target==="mouse"&&e||i.hide.fixed&&/mouse(out|leave|move)/.test(a.type)&&(e||h)){try{a.preventDefault(),a.stopImmediatePropagation()}catch(j){}return}i.hide.delay>0?s.timers.hide=setTimeout(function(){s.hide(a)},i.hide.delay):s.hide(a)}function n(a){if(M.hasClass(z))return f;clearTimeout(s.timers.inactive),s.timers.inactive=setTimeout(function(){s.hide(a)},i.hide.inactive)}function o(a){s.rendered&&M[0].offsetWidth>0&&s.reposition(a)}var c=i.position,g={show:i.show.target,hide:i.hide.target,viewport:d(c.viewport),document:d(b),body:d(b.body),window:d(a)},j={show:d.trim(""+i.show.event).split(" "),hide:d.trim(""+i.hide.event).split(" ")},k=d.browser.msie&&parseInt(d.browser.version,10)===6;M.bind("mouseenter"+N+" mouseleave"+N,function(a){var b=a.type==="mouseenter";b&&s.focus(a),M.toggleClass(D,b)}),/mouse(out|leave)/i.test(i.hide.event)&&i.hide.leave==="window"&&g.window.bind("mouseout"+N+" blur"+N,function(a){!/select|option/.test(a.target.nodeName)&&!a.relatedTarget&&s.hide(a)}),i.hide.fixed?(g.hide=g.hide.add(M),M.bind("mouseover"+N,function(){M.hasClass(z)||clearTimeout(s.timers.hide)})):/mouse(over|enter)/i.test(i.show.event)&&g.hide.bind("mouseleave"+N,function(a){clearTimeout(s.timers.show)}),(""+i.hide.event).indexOf("unfocus")>-1&&c.container.closest("html").bind("mousedown"+N,function(a){var b=d(a.target),c=s.rendered&&!M.hasClass(z)&&M[0].offsetWidth>0,e=b.parents(A).filter(M[0]).length>0;b[0]!==h[0]&&b[0]!==M[0]&&!e&&!h.has(b[0]).length&&!b.attr("disabled")&&s.hide(a)}),"number"==typeof i.hide.inactive&&(g.show.bind("qtip-"+q+"-inactive",n),d.each(t.inactiveEvents,function(a,b){g.hide.add(O.tooltip).bind(b+N+"-inactive",n)})),d.each(j.hide,function(a,b){var c=d.inArray(b,j.show),e=d(g.hide);c>-1&&e.add(g.show).length===e.length||b==="unfocus"?(g.show.bind(b+N,function(a){M[0].offsetWidth>0?m(a):l(a)}),delete j.show[c]):g.hide.bind(b+N,m)}),d.each(j.show,function(a,b){g.show.bind(b+N,l)}),"number"==typeof i.hide.distance&&g.show.add(M).bind("mousemove"+N,function(a){var b=P.origin||{},c=i.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&s.hide(a)}),c.target==="mouse"&&(g.show.bind("mousemove"+N,function(a){v={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),c.adjust.mouse&&(i.hide.event&&(M.bind("mouseleave"+N,function(a){(a.relatedTarget||a.target)!==g.show[0]&&s.hide(a)}),O.target.bind("mouseenter"+N+" mouseleave"+N,function(a){P.onTarget=a.type==="mouseenter"})),g.document.bind("mousemove"+N,function(a){s.rendered&&P.onTarget&&!M.hasClass(z)&&M[0].offsetWidth>0&&s.reposition(a||v)}))),(c.adjust.resize||g.viewport.length)&&(d.event.special.resize?g.viewport:g.window).bind("resize"+N,o),(g.viewport.length||k&&M.css("position")==="fixed")&&g.viewport.bind("scroll"+N,o)}function _(){var c=[i.show.target[0],i.hide.target[0],s.rendered&&O.tooltip[0],i.position.container[0],i.position.viewport[0],i.position.container.closest("html")[0],a,b];s.rendered?d([]).pushStack(d.grep(c,function(a){return typeof a=="object"})).unbind(N):i.show.target.unbind(N+"-create")}var s=this,E=b.body,J=x+"-"+q,K=0,L=0,M=d(),N=".qtip-"+q,O,P;s.id=q,s.rendered=f,s.destroyed=f,s.elements=O={target:h},s.timers={img:{}},s.options=i,s.checks={},s.plugins={},s.cache=P={event:{},target:d(),disabled:f,attr:r,onTarget:f,lastClass:""},s.checks.builtin={"^id$":function(a,b,c){var g=c===e?t.nextid:c,h=x+"-"+g;g!==f&&g.length>0&&!d("#"+h).length&&(M[0].id=h,O.content[0].id=h+"-content",O.title[0].id=h+"-title")},"^content.text$":function(a,b,c){Y(c)},"^content.title.text$":function(a,b,c){if(!c)return T();!O.title&&c&&V(),X(c)},"^content.title.button$":function(a,b,c){W(c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(a[b]=new u.Corner(c))},"^position.container$":function(a,b,c){s.rendered&&M.appendTo(c)},"^show.ready$":function(){s.rendered?s.toggle(e):s.render(1)},"^style.classes$":function(a,b,c){M.attr("class",x+" qtip "+c)},"^style.widget|content.title":S,"^events.(render|show|move|hide|focus|blur)$":function(a,b,c){M[(d.isFunction(c)?"":"un")+"bind"]("tooltip"+b,c)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){var a=i.position;M.attr("tracking",a.target==="mouse"&&a.adjust.mouse),_(),Z()}},d.extend(s,{render:function(a){if(s.rendered)return s;var b=i.content.text,c=i.content.title.text,g=i.position;return d.attr(h[0],"aria-describedby",J),M=O.tooltip=d("<div/>",{id:J,"class":x+" qtip "+B+" "+i.style.classes+" "+x+"-pos-"+i.position.my.abbrev(),width:i.style.width||"",height:i.style.height||"",tracking:g.target==="mouse"&&g.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":f,"aria-describedby":J+"-content","aria-hidden":e}).toggleClass(z,P.disabled).data("qtip",s).appendTo(i.position.container).append(O.content=d("<div />",{"class":x+"-content",id:J+"-content","aria-atomic":e})),s.rendered=-1,L=1,K=1,c&&(V(),d.isFunction(c)||X(c,f)),d.isFunction(b)||Y(b,f),s.rendered=e,S(),d.each(i.events,function(a,b){d.isFunction(b)&&M.bind(a==="toggle"?"tooltipshow tooltiphide":"tooltip"+a,b)}),d.each(u,function(){this.initialize==="render"&&this(s)}),Z(),M.queue("fx",function(b){R("render"),L=0,K=0,s.redraw(),(i.show.ready||a)&&s.toggle(e,P.event,f),b()}),s},get:function(a){var b,c;switch(a.toLowerCase()){case"dimensions":b={height:M.outerHeight(),width:M.outerWidth()};break;case"offset":b=u.offset(M,i.position.container);break;default:c=Q(a.toLowerCase()),b=c[0][c[1]],b=b.precedance?b.string():b}return b},set:function(a,b){function n(a,b){var c,d,e;for(c in l)for(d in l[c])if(e=(new RegExp(d,"i")).exec(a))b.push(e),l[c][d].apply(s,b)}var c=/^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,h=/^content\.(title|attr)|style/i,j=f,k=f,l=s.checks,m;return"string"==typeof a?(m=a,a={},a[m]=b):a=d.extend(e,{},a),d.each(a,function(b,e){var f=Q(b.toLowerCase()),g;g=f[0][f[1]],f[0][f[1]]="object"==typeof e&&e.nodeType?d(e):e,a[b]=[f[0],f[1],e,g],j=c.test(b)||j,k=h.test(b)||k}),I(i),K=L=1,d.each(a,n),K=L=0,s.rendered&&M[0].offsetWidth>0&&(j&&s.reposition(i.position.target==="mouse"?g:P.event),k&&s.redraw()),s},toggle:function(a,c){function t(){a?(d.browser.msie&&M[0].style.removeAttribute("filter"),M.css("overflow",""),"string"==typeof h.autofocus&&d(h.autofocus,M).focus(),h.target.trigger("qtip-"+q+"-inactive")):M.css({display:"",visibility:"",opacity:"",left:"",top:""}),R(a?"visible":"hidden")}if(!s.rendered)return a?s.render(1):s;var g=a?"show":"hide",h=i[g],j=i[a?"hide":"show"],k=i.position,l=i.content,m=M[0].offsetWidth>0,n=a||h.target.length===1,o=!c||h.target.length<2||P.target[0]===c.target,p,r;(typeof a).search("boolean|number")&&(a=!m);if(!M.is(":animated")&&m===a&&o)return s;if(c){if(/over|enter/.test(c.type)&&/out|leave/.test(P.event.type)&&i.show.target.add(c.target).length===i.show.target.length&&M.has(c.relatedTarget).length)return s;P.event=d.extend({},c)}return R(g,[90])?(d.attr(M[0],"aria-hidden",!a),a?(P.origin=d.extend({},v),s.focus(c),d.isFunction(l.text)&&Y(l.text,f),d.isFunction(l.title.text)&&X(l.title.text,f),!G&&k.target==="mouse"&&k.adjust.mouse&&(d(b).bind("mousemove.qtip",function(a){v={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),G=e),s.reposition(c,arguments[2]),!h.solo||d(A,h.solo).not(M).qtip("hide",d.Event("tooltipsolo"))):(clearTimeout(s.timers.show),delete P.origin,G&&!d(A+'[tracking="true"]:visible',h.solo).not(M).length&&(d(b).unbind("mousemove.qtip"),G=f),s.blur(c)),h.effect===f||n===f?(M[g](),t.call(M)):d.isFunction(h.effect)?(M.stop(1,1),h.effect.call(M,s),M.queue("fx",function(a){t(),a()})):M.fadeTo(90,a?1:0,t),a&&h.target.trigger("qtip-"+q+"-inactive"),s):s},show:function(a){return s.toggle(e,a)},hide:function(a){return s.toggle(f,a)},focus:function(a){if(!s.rendered)return s;var b=d(A),c=parseInt(M[0].style.zIndex,10),e=t.zindex+b.length,f=d.extend({},a),g;return M.hasClass(C)||R("focus",[e],f)&&(c!==e&&(b.each(function(){this.style.zIndex>c&&(this.style.zIndex=this.style.zIndex-1)}),b.filter("."+C).qtip("blur",f)),M.addClass(C)[0].style.zIndex=e),s},blur:function(a){return M.removeClass(C),R("blur",[M.css("zIndex")],a),s},reposition:function(c,e){if(!s.rendered||K)return s;K=1;var g=i.position.target,h=i.position,j=h.my,k=h.at,q=h.adjust,r=q.method.split(" "),t=M.outerWidth(),w=M.outerHeight(),x=0,y=0,z=M.css("position")==="fixed",A=h.viewport,B={left:0,top:0},C=h.container,D=M[0].offsetWidth>0,E,F,G;if(d.isArray(g)&&g.length===2)k={x:m,y:l},B={left:g[0],top:g[1]};else if(g==="mouse"&&(c&&c.pageX||P.event.pageX))k={x:m,y:l},c=(!c||c.type!=="resize"&&c.type!=="scroll"?c&&c.pageX&&c.type==="mousemove"?c:v&&v.pageX&&(q.mouse||!c||!c.pageX)?{pageX:v.pageX,pageY:v.pageY}:!q.mouse&&P.origin&&P.origin.pageX&&i.show.distance?P.origin:c:P.event)||c||P.event||v||{},B={top:c.pageY,left:c.pageX};else{g==="event"&&c&&c.target&&c.type!=="scroll"&&c.type!=="resize"?P.target=d(c.target):g!=="event"&&(P.target=d(g.jquery?g:O.target)),g=P.target,g=d(g).eq(0);if(g.length===0)return s;g[0]===b||g[0]===a?(x=u.iOS?a.innerWidth:g.width(),y=u.iOS?a.innerHeight:g.height(),g[0]===a&&(B={top:(A||g).scrollTop(),left:(A||g).scrollLeft()})):u.imagemap&&g.is("area")?E=u.imagemap(s,g,k,u.viewport?r:f):u.svg&&typeof g[0].xmlbase=="string"?E=u.svg(s,g,k,u.viewport?r:f):(x=g.outerWidth(),y=g.outerHeight(),B=u.offset(g,C)),E&&(x=E.width,y=E.height,F=E.offset,B=E.position);if(u.iOS>3.1&&u.iOS<4.1||u.iOS>=4.3&&u.iOS<4.33||!u.iOS&&z)G=d(a),B.left-=G.scrollLeft(),B.top-=G.scrollTop();B.left+=k.x===o?x:k.x===p?x/2:0,B.top+=k.y===n?y:k.y===p?y/2:0}return B.left+=q.x+(j.x===o?-t:j.x===p?-t/2:0),B.top+=q.y+(j.y===n?-w:j.y===p?-w/2:0),u.viewport?(B.adjusted=u.viewport(s,B,h,x,y,t,w),F&&B.adjusted.left&&(B.left+=F.left),F&&B.adjusted.top&&(B.top+=F.top)):B.adjusted={left:0,top:0},R("move",[B,A.elem||A],c)?(delete B.adjusted,e===f||!D||isNaN(B.left)||isNaN(B.top)||g==="mouse"||!d.isFunction(h.effect)?M.css(B):d.isFunction(h.effect)&&(h.effect.call(M,s,d.extend({},B)),M.queue(function(a){d(this).css({opacity:"",height:""}),d.browser.msie&&this.style.removeAttribute("filter"),a()})),K=0,s):s},redraw:function(){if(s.rendered<1||L)return s;var a=i.style,b=i.position.container,c,d,e,f;return L=1,R("redraw"),a.height&&M.css(k,a.height),a.width?M.css(j,a.width):(M.css(j,"").appendTo(H),d=M.width(),d%2<1&&(d+=1),e=M.css("max-width")||"",f=M.css("min-width")||"",c=(e+f).indexOf("%")>-1?b.width()/100:0,e=(e.indexOf("%")>-1?c:1)*parseInt(e,10)||d,f=(f.indexOf("%")>-1?c:1)*parseInt(f,10)||0,d=e+f?Math.min(Math.max(d,f),e):d,M.css(j,Math.round(d)).appendTo(b)),R("redrawn"),L=0,s},disable:function(a){return"boolean"!=typeof a&&(a=!M.hasClass(z)&&!P.disabled),s.rendered?(M.toggleClass(z,a),d.attr(M[0],"aria-disabled",a)):P.disabled=!!a,s},enable:function(){return s.disable(f)},destroy:function(){var a=h[0],b=d.attr(a,F),c=h.data("qtip");s.destroyed=e,s.rendered&&(M.stop(1,0).remove(),d.each(s.plugins,function(){this.destroy&&this.destroy()})),clearTimeout(s.timers.show),clearTimeout(s.timers.hide),_();if(!c||s===c)d.removeData(a,"qtip"),i.suppress&&b&&(d.attr(a,"title",b),h.removeAttr(F)),h.removeAttr("aria-describedby");return h.unbind(".qtip-"+q),delete w[s.id],h}})}function K(a,c){var h,i,j,k,l,m=d(this),n=d(b.body),o=this===b?n:m,p=m.metadata?m.metadata(c.metadata):g,q=c.metadata.type==="html5"&&p?p[c.metadata.name]:g,r=m.data(c.metadata.name||"qtipopts");try{r=typeof r=="string"?d.parseJSON(r):r}catch(s){}k=d.extend(e,{},t.defaults,c,typeof r=="object"?I(r):g,I(q||p)),i=k.position,k.id=a;if("boolean"==typeof k.content.text){j=m.attr(k.content.attr);if(k.content.attr!==f&&j)k.content.text=j;else return f}i.container.length||(i.container=n),i.target===f&&(i.target=o),k.show.target===f&&(k.show.target=o),k.show.solo===e&&(k.show.solo=i.container.closest("body")),k.hide.target===f&&(k.hide.target=o),k.position.viewport===e&&(k.position.viewport=i.container),i.container=i.container.eq(0),i.at=new u.Corner(i.at),i.my=new u.Corner(i.my);if(d.data(this,"qtip"))if(k.overwrite)m.qtip("destroy");else if(k.overwrite===f)return f;return k.suppress&&(l=d.attr(this,"title"))&&d(this).removeAttr("title").attr(F,l).attr("title",""),h=new J(m,k,a,!!j),d.data(this,"qtip",h),m.bind("remove.qtip-"+a+" removeqtip.qtip-"+a,function(){h.destroy()}),h}function L(a){var b=this,c=a.elements.tooltip,g=a.options.content.ajax,h=t.defaults.content.ajax,i=".qtip-ajax",j=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,k=e,l=f,m;a.checks.ajax={"^content.ajax":function(a,d,e){d==="ajax"&&(g=e),d==="once"?b.init():g&&g.url?b.load():c.unbind(i)}},d.extend(b,{init:function(){return g&&g.url&&c.unbind(i)[g.once?"one":"bind"]("tooltipshow"+i,b.load),b},load:function(c){function r(){var b;if(a.destroyed)return;k=f,p&&(l=e,a.show(c.originalEvent)),(b=h.complete||g.complete)&&d.isFunction(b)&&b.apply(g.context||a,arguments)}function s(b,c,e){var f;if(a.destroyed)return;o&&"string"==typeof b&&(b=d("<div/>").append(b.replace(j,"")).find(o)),(f=h.success||g.success)&&d.isFunction(f)?f.call(g.context||a,b,c,e):a.set("content.text",b)}function t(b,c,d){if(a.destroyed||b.status===0)return;a.set("content.text",c+": "+d)}if(l){l=f;return}var i=g.url.lastIndexOf(" "),n=g.url,o,p=!g.loading&&k;if(p)try{c.preventDefault()}catch(q){}else if(c&&c.isDefaultPrevented())return b;m&&m.abort&&m.abort(),i>-1&&(o=n.substr(i),n=n.substr(0,i)),m=d.ajax(d.extend({error:h.error||t,context:a},g,{url:n,success:s,complete:r}))},destroy:function(){m&&m.abort&&m.abort(),a.destroyed=e}}),b.init()}function M(a,b,c){var d=Math.ceil(b/2),e=Math.ceil(c/2),f={bottomright:[[0,0],[b,c],[b,0]],bottomleft:[[0,0],[b,0],[0,c]],topright:[[0,c],[b,0],[b,c]],topleft:[[0,0],[0,c],[b,c]],topcenter:[[0,c],[d,0],[b,c]],bottomcenter:[[0,0],[b,0],[d,c]],rightcenter:[[0,0],[b,e],[0,c]],leftcenter:[[b,0],[b,c],[0,e]]};return f.lefttop=f.bottomright,f.righttop=f.bottomleft,f.leftbottom=f.topright,f.rightbottom=f.topleft,f[a.string()]}function N(a,b){function D(a){var b=v.is(":visible");v.show(),a(),v.toggle(b)}function E(){x.width=r.height,x.height=r.width}function F(){x.width=r.width,x.height=r.height}function G(b,d,g,j){if(!t.tip)return;var k=q.corner.clone(),u=g.adjusted,v=a.options.position.adjust.method.split(" "),x=v[0],y=v[1]||v[0],z={left:f,top:f,x:0,y:0},A,B={},C;q.corner.fixed!==e&&(x===s&&k.precedance===h&&u.left&&k.y!==p?k.precedance=k.precedance===h?i:h:x!==s&&u.left&&(k.x=k.x===p?u.left>0?m:o:k.x===m?o:m),y===s&&k.precedance===i&&u.top&&k.x!==p?k.precedance=k.precedance===i?h:i:y!==s&&u.top&&(k.y=k.y===p?u.top>0?l:n:k.y===l?n:l),k.string()!==w.corner.string()&&(w.top!==u.top||w.left!==u.left)&&q.update(k,f)),A=q.position(k,u),A[k.x]+=I(k,k.x),A[k.y]+=I(k,k.y),A.right!==c&&(A.left=-A.right),A.bottom!==c&&(A.top=-A.bottom),A.user=Math.max(0,r.offset);if(z.left=x===s&&!!u.left)k.x===p?B["margin-left"]=z.x=A["margin-left"]-u.left:(C=A.right!==c?[u.left,-A.left]:[-u.left,A.left],(z.x=Math.max(C[0],C[1]))>C[0]&&(g.left-=u.left,z.left=f),B[A.right!==c?o:m]=z.x);if(z.top=y===s&&!!u.top)k.y===p?B["margin-top"]=z.y=A["margin-top"]-u.top:(C=A.bottom!==c?[u.top,-A.top]:[-u.top,A.top],(z.y=Math.max(C[0],C[1]))>C[0]&&(g.top-=u.top,z.top=f),B[A.bottom!==c?n:l]=z.y);t.tip.css(B).toggle(!(z.x&&z.y||k.x===p&&z.y||k.y===p&&z.x)),g.left-=A.left.charAt?A.user:x!==s||z.top||!z.left&&!z.top?A.left:0,g.top-=A.top.charAt?A.user:y!==s||z.left||!z.left&&!z.top?A.top:0,w.left=u.left,w.top=u.top,w.corner=k.clone()}function H(){var b=r.corner,c=a.options.position,d=c.at,g=c.my.string?c.my.string():c.my;return b===f||g===f&&d===f?f:(b===e?q.corner=new u.Corner(g):b.string||(q.corner=new u.Corner(b),q.corner.fixed=e),w.corner=new u.Corner(q.corner.string()),q.corner.string()!=="centercenter")}function I(a,b,c){b=b?b:a[a.precedance];var d=t.titlebar&&a.y===l,e=d?t.titlebar:v,f="border-"+b+"-width",g=function(a){return parseInt(a.css(f),10)},h;return D(function(){h=(c?g(c):g(t.content)||g(e)||g(v))||0}),h}function J(a){var b=t.titlebar&&a.y===l,c=b?t.titlebar:t.content,e=d.browser.mozilla,f=e?"-moz-":d.browser.webkit?"-webkit-":"",g="border-radius-"+a.y+a.x,h="border-"+a.y+"-"+a.x+"-radius",i=function(a){return parseInt(c.css(a),10)||parseInt(v.css(a),10)},j;return D(function(){j=i(h)||i(f+h)||i(f+g)||i(g)||0}),j}function K(a){function z(a,b,c){var d=a.css(b)||n;return c&&d===a.css(c)?f:j.test(d)?f:d}var b,c,g,h=t.tip.css("cssText",""),i=a||q.corner,j=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,k="border-"+i[i.precedance]+"-color",m="background-color",n="transparent",o=" !important",s=t.titlebar,u=s&&(i.y===l||i.y===p&&h.position().top+x.height/2+r.offset<s.outerHeight(e)),w=u?s:t.content;D(function(){y.fill=z(h,m)||z(w,m)||z(t.content,m)||z(v,m)||h.css(m),y.border=z(h,k,"color")||z(w,k,"color")||z(t.content,k,"color")||z(v,k,"color")||v.css(k),d("*",h).add(h).css("cssText",m+":"+n+o+";border:0"+o+";")})}function L(a){var b=a.precedance===i,c=x[b?j:k],d=x[b?k:j],e=a.string().indexOf(p)>-1,f=c*(e?.5:1),g=Math.pow,h=Math.round,l,m,n,o=Math.sqrt(g(f,2)+g(d,2)),q=[z/f*o,z/d*o];return q[2]=Math.sqrt(g(q[0],2)-g(z,2)),q[3]=Math.sqrt(g(q[1],2)-g(z,2)),l=o+q[2]+q[3]+(e?0:q[0]),m=l/o,n=[h(m*d),h(m*c)],{height:n[b?0:1],width:n[b?1:0]}}function N(a,b,c){return"<qvml:"+a+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(b||"")+' style="behavior: url(#default#VML); '+(c||"")+'" />'}var q=this,r=a.options.style.tip,t=a.elements,v=t.tooltip,w={top:0,left:0},x={width:r.width,height:r.height},y={},z=r.border||0,A=".qtip-tip",B=!!(d("<canvas />")[0]||{}).getContext,C;q.corner=g,q.mimic=g,q.border=z,q.offset=r.offset,q.size=x,a.checks.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){q.init()||q.destroy(),a.reposition()},"^style.tip.(height|width)$":function(){x={width:r.width,height:r.height},q.create(),q.update(),a.reposition()},"^content.title.text|style.(classes|widget)$":function(){t.tip&&t.tip.length&&q.update()}},d.extend(q,{init:function(){var a=H()&&(B||d.browser.msie);return a&&(q.create(),q.update(),v.unbind(A).bind("tooltipmove"+A,G),B||v.bind("tooltipredraw tooltipredrawn",function(a){a.type==="tooltipredraw"?(C=t.tip.html(),t.tip.html("")):t.tip.html(C)})),a},create:function(){var a=x.width,b=x.height,c;t.tip&&t.tip.remove(),t.tip=d("<div />",{"class":"ui-tooltip-tip"}).css({width:a,height:b}).prependTo(v),B?d("<canvas />").appendTo(t.tip)[0].getContext("2d").save():(c=N("shape",'coordorigin="0,0"',"position:absolute;"),t.tip.html(c+c),d("*",t.tip).bind("click mousedown",function(a){a.stopPropagation()}))},update:function(a,b){var c=t.tip,j=c.children(),k=x.width,s=x.height,A=r.mimic,C=Math.round,D,G,H,J,O;a||(a=w.corner||q.corner),A===f?A=a:(A=new u.Corner(A),A.precedance=a.precedance,A.x==="inherit"?A.x=a.x:A.y==="inherit"?A.y=a.y:A.x===A.y&&(A[a.precedance]=a[a.precedance])),D=A.precedance,a.precedance===h?E():F(),t.tip.css({width:k=x.width,height:s=x.height}),K(a),y.border!=="transparent"?(z=I(a,g),r.border===0&&z>0&&(y.fill=y.border),q.border=z=r.border!==e?r.border:z):q.border=z=0,H=M(A,k,s),q.size=O=L(a),c.css(O),a.precedance===i?J=[C(A.x===m?z:A.x===o?O.width-k-z:(O.width-k)/2),C(A.y===l?O.height-s:0)]:J=[C(A.x===m?O.width-k:0),C(A.y===l?z:A.y===n?O.height-s-z:(O.height-s)/2)],B?(j.attr(O),G=j[0].getContext("2d"),G.restore(),G.save(),G.clearRect(0,0,3e3,3e3),G.fillStyle=y.fill,G.strokeStyle=y.border,G.lineWidth=z*2,G.lineJoin="miter",G.miterLimit=100,G.translate(J[0],J[1]),G.beginPath(),G.moveTo(H[0][0],H[0][1]),G.lineTo(H[1][0],H[1][1]),G.lineTo(H[2][0],H[2][1]),G.closePath(),z&&(v.css("background-clip")==="border-box"&&(G.strokeStyle=y.fill,G.stroke()),G.strokeStyle=y.border,G.stroke()),G.fill()):(H="m"+H[0][0]+","+H[0][1]+" l"+H[1][0]+","+H[1][1]+" "+H[2][0]+","+H[2][1]+" xe",J[2]=z&&/^(r|b)/i.test(a.string())?parseFloat(d.browser.version,10)===8?2:1:0,j.css({coordsize:k+z+" "+(s+z),antialias:""+(A.string().indexOf(p)>-1),left:J[0],top:J[1],width:k+z,height:s+z}).each(function(a){var b=d(this);b[b.prop?"prop":"attr"]({coordsize:k+z+" "+(s+z),path:H,fillcolor:y.fill,filled:!!a,stroked:!a}).toggle(!!z||!!a),!a&&b.html()===""&&b.html(N("stroke",'weight="'+z*2+'px" color="'+y.border+'" miterlimit="1000" joinstyle="miter"'))})),b!==f&&q.position(a)},position:function(a){var b=t.tip,c={},e=Math.max(0,r.offset),g,n,o;return r.corner===f||!b?f:(a=a||q.corner,g=a.precedance,n=L(a),o=[a.x,a.y],g===h&&o.reverse(),d.each(o,function(b,d){var f,h,o;d===p?(f=g===i?m:l,c[f]="50%",c["margin-"+f]=-Math.round(n[g===i?j:k]/2)+e):(f=I(a,d),h=I(a,d,t.content),o=J(a),c[d]=b?h:e+(o>f?o:-f))}),c[a[g]]-=n[g===h?j:k],b.css({top:"",bottom:"",left:"",right:"",margin:""}).css(c),c)},destroy:function(){t.tip&&t.tip.remove(),t.tip=!1,v.unbind(A)}}),q.init()}function O(c){function s(){q=d(p,j).not("[disabled]").map(function(){return typeof this.focus=="function"?this:null})}function t(a){q.length<1&&a.length?a.not("body").blur():q.first().focus()}function v(a){var b=d(a.target),c=b.closest(".qtip"),e;e=c.length<1?f:parseInt(c[0].style.zIndex,10)>parseInt(j[0].style.zIndex,10),!e&&d(a.target).closest(A)[0]!==j[0]&&t(b)}var g=this,h=c.options.show.modal,i=c.elements,j=i.tooltip,k="#qtip-overlay",l=".qtipmodal",m=l+c.id,n="is-modal-qtip",o=d(b.body),p=u.modal.focusable.join(","),q={},r;c.checks.modal={"^show.modal.(on|blur)$":function(){g.init(),i.overlay.toggle(j.is(":visible"))},"^content.text$":function(){s()}},d.extend(g,{init:function(){return h.on?(r=g.create(),j.attr(n,e).css("z-index",u.modal.zindex+d(A+"["+n+"]").length).unbind(l).unbind(m).bind("tooltipshow"+l+" tooltiphide"+l,function(a,b,c){var e=a.originalEvent;if(a.target===j[0])if(e&&a.type==="tooltiphide"&&/mouse(leave|enter)/.test(e.type)&&d(e.relatedTarget).closest(r[0]).length)try{a.preventDefault()}catch(f){}else(!e||e&&!e.solo)&&g[a.type.replace("tooltip","")](a,c)}).bind("tooltipfocus"+l,function(a){if(a.isDefaultPrevented()||a.target!==j[0])return;var b=d(A).filter("["+n+"]"),c=u.modal.zindex+b.length,e=parseInt(j[0].style.zIndex,10);r[0].style.zIndex=c-2,b.each(function(){this.style.zIndex>e&&(this.style.zIndex-=1)}),b.end().filter("."+C).qtip("blur",a.originalEvent),j.addClass(C)[0].style.zIndex=c;try{a.preventDefault()}catch(f){}}).bind("tooltiphide"+l,function(a){a.target===j[0]&&d("["+n+"]").filter(":visible").not(j).last().qtip("focus",a)}),h.escape&&d(b).unbind(m).bind("keydown"+m,function(a){a.keyCode===27&&j.hasClass(C)&&c.hide(a)}),h.blur&&i.overlay.unbind(m).bind("click"+m,function(a){j.hasClass(C)&&c.hide(a)}),s(),g):g},create:function(){function c(){r.css({height:d(a).height(),width:d(a).width()})}var b=d(k);return b.length?i.overlay=b.insertAfter(d(A).last()):(r=i.overlay=d("<div />",{id:k.substr(1),html:"<div></div>",mousedown:function(){return f}}).hide().insertAfter(d(A).last()),d(a).unbind(l).bind("resize"+l,c),c(),r)},toggle:function(a,b,c){if(a&&a.isDefaultPrevented())return g;var i=h.effect,k=b?"show":"hide",l=r.is(":visible"),p=d("["+n+"]").filter(":visible").not(j),q;return r||(r=g.create()),r.is(":animated")&&l===b||!b&&p.length?g:(b?(r.css({left:0,top:0}),r.toggleClass("blurs",h.blur),h.stealfocus!==f&&(o.bind("focusin"+m,v),t(d("body :focus")))):o.unbind("focusin"+m),r.stop(e,f),d.isFunction(i)?i.call(r,b):i===f?r[k]():r.fadeTo(parseInt(c,10)||90,b?1:0,function(){b||d(this).hide()}),b||r.queue(function(a){r.css({left:"",top:""}),a()}),g)},show:function(a,b){return g.toggle(a,e,b)},hide:function(a,b){return g.toggle(a,f,b)},destroy:function(){var a=r;return a&&(a=d("["+n+"]").not(j).length<1,a?(i.overlay.remove(),d(b).unbind(l)):i.overlay.unbind(l+c.id),o.undelegate("*","focusin"+m)),j.removeAttr(n).unbind(l)}}),g.init()}function P(a){var b=this,c=a.elements,e=c.tooltip,f=".bgiframe-"+a.id;d.extend(b,{init:function(){c.bgiframe=d('<iframe class="ui-tooltip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';"  style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>'),c.bgiframe.appendTo(e),e.bind("tooltipmove"+f,b.adjust)},adjust:function(){var b=a.get("dimensions"),d=a.plugins.tip,f=c.tip,g,h;h=parseInt(e.css("border-left-width"),10)||0,h={left:-h,top:-h},d&&f&&(g=d.corner.precedance==="x"?["width","left"]:["height","top"],h[g[1]]-=f[g[0]]()),c.bgiframe.css(h).css(b)},destroy:function(){c.bgiframe.remove(),e.unbind(f)}}),b.init()}var e=!0,f=!1,g=null,h="x",i="y",j="width",k="height",l="top",m="left",n="bottom",o="right",p="center",q="flip",r="flipinvert",s="shift",t,u,v,w={},x="ui-tooltip",y="ui-widget",z="ui-state-disabled",A="div.qtip."+x,B=x+"-default",C=x+"-focus",D=x+"-hover",E="_replacedByqTip",F="oldtitle",G,H;H=d("<div/>",{id:"qtip-rcontainer"}),d(function(){H.appendTo(b.body)}),t=d.fn.qtip=function(a,b,h){var i=(""+a).toLowerCase(),j=g,k=d.makeArray(arguments).slice(1),l=k[k.length-1],m=this[0]?d.data(this[0],"qtip"):g;if(!arguments.length&&m||i==="api")return m;if("string"==typeof a)return this.each(function(){var a=d.data(this,"qtip");if(!a)return e;l&&l.timeStamp&&(a.cache.event=l);if(i!=="option"&&i!=="options"||!b)a[i]&&a[i].apply(a[i],k);else if(d.isPlainObject(b)||h!==c)a.set(b,h);else return j=a.get(b),f}),j!==g?j:this;if("object"==typeof a||!arguments.length)return m=I(d.extend(e,{},a)),t.bind.call(this,m,l)},t.bind=function(a,b){return this.each(function(g){function n(a){function b(){l.render(typeof a=="object"||h.show.ready),i.show.add(i.hide).unbind(k)}if(l.cache.disabled)return f;l.cache.event=d.extend({},a),l.cache.target=a?d(a.target):[c],h.show.delay>0?(clearTimeout(l.timers.show),l.timers.show=setTimeout(b,h.show.delay),j.show!==j.hide&&i.hide.bind(j.hide,function(){clearTimeout(l.timers.show)})):b()}var h,i,j,k,l,m;m=d.isArray(a.id)?a.id[g]:a.id,m=!m||m===f||m.length<1||w[m]?t.nextid++:w[m]=m,k=".qtip-"+m+"-create",l=K.call(this,m,a);if(l===f)return e;h=l.options,d.each(u,function(){this.initialize==="initialize"&&this(l)}),i={show:h.show.target,hide:h.hide.target},j={show:d.trim(""+h.show.event).replace(/ /g,k+" ")+k,hide:d.trim(""+h.hide.event).replace(/ /g,k+" ")+k},/mouse(over|enter)/i.test(j.show)&&!/mouse(out|leave)/i.test(j.hide)&&(j.hide+=" mouseleave"+k),i.show.bind("mousemove"+k,function(a){v={pageX:a.pageX,pageY:a.pageY,type:"mousemove"},l.cache.onTarget=e}),i.show.bind(j.show,n),(h.show.ready||h.prerender)&&n(b)})},u=t.plugins={Corner:function(a){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,p).toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase();var b=a.charAt(0);this.precedance=b==="t"||b==="b"?i:h,this.string=function(){return this.precedance===i?this.y+this.x:this.x+this.y},this.abbrev=function(){var a=this.x.substr(0,1),b=this.y.substr(0,1);return a===b?a:this.precedance===i?b+a:a+b},this.invertx=function(a){this.x=this.x===m?o:this.x===o?m:a||this.x},this.inverty=function(a){this.y=this.y===l?n:this.y===n?l:a||this.y},this.clone=function(){return{x:this.x,y:this.y,precedance:this.precedance,string:this.string,abbrev:this.abbrev,clone:this.clone,invertx:this.invertx,inverty:this.inverty}}},offset:function(a,b){function j(a,b){c.left+=b*a.scrollLeft(),c.top+=b*a.scrollTop()}var c=a.offset(),e=a.closest("body")[0],f=b,g,h,i;if(f){do f.css("position")!=="static"&&(h=f.position(),c.left-=h.left+(parseInt(f.css("borderLeftWidth"),10)||0)+(parseInt(f.css("marginLeft"),10)||0),c.top-=h.top+(parseInt(f.css("borderTopWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0),!g&&(i=f.css("overflow"))!=="hidden"&&i!=="visible"&&(g=f));while((f=d(f[0].offsetParent)).length);g&&g[0]!==e&&j(g,1)}return c},iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||f,fn:{attr:function(a,b){if(this.length){var c=this[0],e="title",f=d.data(c,"qtip");if(a===e&&f&&"object"==typeof f&&f.options.suppress)return arguments.length<2?d.attr(c,F):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",b),this.attr(F,b))}return d.fn["attr"+E].apply(this,arguments)},clone:function(a){var b=d([]),c="title",e=d.fn["clone"+E].apply(this,arguments);return a||e.filter("["+F+"]").attr("title",function(){return d.attr(this,F)}).removeAttr(F),e}}},d.each(u.fn,function(a,b){if(!b||d.fn[a+E])return e;var c=d.fn[a+E]=d.fn[a];d.fn[a]=function(){return b.apply(this,arguments)||c.apply(this,arguments)}}),d.ui||(d["cleanData"+E]=d.cleanData,d.cleanData=function(a){for(var b=0,e;(e=a[b])!==c;b++)try{d(e).triggerHandler("removeqtip")}catch(f){}d["cleanData"+E](a)}),t.version="@VERSION",t.nextid=0,t.inactiveEvents="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),t.zindex=15e3,t.defaults={prerender:f,id:f,overwrite:e,suppress:e,content:{text:e,attr:"title",title:{text:f,button:f}},position:{my:"top left",at:"bottom right",target:f,container:f,viewport:f,adjust:{x:0,y:0,mouse:e,resize:e,method:"flip flip"},effect:function(a,b,c){d(this).animate(b,{duration:200,queue:f})}},show:{target:f,event:"mouseenter",effect:e,delay:90,solo:f,ready:f,autofocus:f},hide:{target:f,event:"mouseleave",effect:e,delay:0,fixed:f,inactive:f,leave:"window",distance:f},style:{classes:"",widget:f,width:f,height:f,def:e},events:{render:g,move:g,show:g,hide:g,toggle:g,visible:g,hidden:g,focus:g,blur:g}},u.svg=function(a,c,e,f){var g=d(b),h=c[0],i={width:0,height:0,position:{top:1e10,left:1e10}},j,k,l,m,n;while(!h.getBBox)h=h.parentNode;if(h.getBBox&&h.parentNode){j=h.getBBox(),k=h.getScreenCTM(),l=h.farthestViewportElement||h;if(!l.createSVGPoint)return i;m=l.createSVGPoint(),m.x=j.x,m.y=j.y,n=m.matrixTransform(k),i.position.left=n.x,i.position.top=n.y,m.x+=j.width,m.y+=j.height,n=m.matrixTransform(k),i.width=n.x-i.position.left,i.height=n.y-i.position.top,i.position.left+=g.scrollLeft(),i.position.top+=g.scrollTop()}return i},u.ajax=function(a){var b=a.plugins.ajax;return"object"==typeof b?b:a.plugins.ajax=new L(a)},u.ajax.initialize="render",u.ajax.sanitize=function(a){var b=a.content,c;b&&"ajax"in b&&(c=b.ajax,typeof c!="object"&&(c=a.content.ajax={url:c}),"boolean"!=typeof c.once&&c.once&&(c.once=!!c.once))},d.extend(e,t.defaults,{content:{ajax:{loading:e,once:e}}}),u.tip=function(a){var b=a.plugins.tip;return"object"==typeof b?b:a.plugins.tip=new N(a)},u.tip.initialize="render",u.tip.sanitize=function(a){var b=a.style,c;b&&"tip"in b&&(c=a.style.tip,typeof c!="object"&&(a.style.tip={corner:c}),/string|boolean/i.test(typeof c.corner)||(c.corner=e),typeof c.width!="number"&&delete c.width,typeof c.height!="number"&&delete c.height,typeof c.border!="number"&&c.border!==e&&delete c.border,typeof c.offset!="number"&&delete c.offset)},d.extend(e,t.defaults,{style:{tip:{corner:e,mimic:f,width:6,height:6,border:e,offset:0}}}),u.modal=function(a){var b=a.plugins.modal;return"object"==typeof b?b:a.plugins.modal=new O(a)},u.modal.initialize="render",u.modal.sanitize=function(a){a.show&&(typeof a.show.modal!="object"?a.show.modal={on:!!a.show.modal}:typeof a.show.modal.on=="undefined"&&(a.show.modal.on=e))},u.modal.zindex=t.zindex-200,u.modal.focusable=["a[href]","area[href]","input","select","textarea","button","iframe","object","embed","[tabindex]","[contenteditable]"],d.extend(e,t.defaults,{show:{modal:{on:f,effect:e,blur:e,stealfocus:e,escape:e}}}),u.viewport=function(c,d,e,f,g,q,t){function L(a,b,c,e,f,g,h,i,j){var k=d[f],l=w[a],m=y[a],n=c===s,o=-E.offset[f]+D.offset[f]+D["scroll"+f],q=l===f?j:l===g?-j:-j/2,t=m===f?i:m===g?-i:-i/2,u=G&&G.size?G.size[h]||0:0,v=G&&G.corner&&G.corner.precedance===a&&!n?u:0,x=o-k+v,z=k+j-D[h]-o+v,A=q-(w.precedance===a||l===w[b]?t:0)-(m===p?i/2:0);return n?(v=G&&G.corner&&G.corner.precedance===b?u:0,A=(l===f?1:-1)*q-v,d[f]+=x>0?x:z>0?-z:0,d[f]=Math.max(-E.offset[f]+D.offset[f]+(v&&G.corner[a]===p?G.offset:0),k-A,Math.min(Math.max(-E.offset[f]+D.offset[f]+D[h],k+A),d[f]))):(e*=c===r?2:0,x>0&&(l!==f||z>0)?(d[f]-=A+e,J["invert"+a](f)):z>0&&(l!==g||x>0)&&(d[f]-=(l===p?-A:A)+e,J["invert"+a](g)),d[f]<o&&-d[f]>z&&(d[f]=k,J=w.clone())),d[f]-k}var u=e.target,v=c.elements.tooltip,w=e.my,y=e.at,z=e.adjust,A=z.method.split(" "),B=A[0],C=A[1]||A[0],D=e.viewport,E=e.container,F=c.cache,G=c.plugins.tip,H={left:0,top:0},I,J,K;if(!D.jquery||u[0]===a||u[0]===b.body||z.method==="none")return H;I=v.css("position")==="fixed",D={elem:D,height:D[(D[0]===a?"h":"outerH")+"eight"](),width:D[(D[0]===a?"w":"outerW")+"idth"](),scrollleft:I?0:D.scrollLeft(),scrolltop:I?0:D.scrollTop(),offset:D.offset()||{left:0,top:0}},E={elem:E,scrollLeft:E.scrollLeft(),scrollTop:E.scrollTop(),offset:E.offset()||{left:0,top:0}};if(B!=="shift"||C!=="shift")J=w.clone();return H={left:B!=="none"?L(h,i,B,z.x,m,o,j,f,q):0,top:C!=="none"?L(i,h,C,z.y,l,n,k,g,t):0},J&&F.lastClass!==(K=x+"-pos-"+J.abbrev())&&v.removeClass(c.cache.lastClass).addClass(c.cache.lastClass=K),H},u.imagemap=function(a,b,c,e){function v(a,b,c){var d=0,e=1,f=1,g=0,h=0,i=a.width,j=a.height;while(i>0&&j>0&&e>0&&f>0){i=Math.floor(i/2),j=Math.floor(j/2),c.x===m?e=i:c.x===o?e=a.width-i:e+=Math.floor(i/2),c.y===l?f=j:c.y===n?f=a.height-j:f+=Math.floor(j/2),d=b.length;while(d--){if(b.length<2)break;g=b[d][0]-a.position.left,h=b[d][1]-a.position.top,(c.x===m&&g>=e||c.x===o&&g<=e||c.x===p&&(g<e||g>a.width-e)||c.y===l&&h>=f||c.y===n&&h<=f||c.y===p&&(h<f||h>a.height-f))&&b.splice(d,1)}}return{left:b[0][0],top:b[0][1]}}b.jquery||(b=d(b));var f=a.cache.areas={},g=(b[0].shape||b.attr("shape")).toLowerCase(),h=b[0].coords||b.attr("coords"),i=h.split(","),j=[],k=d('img[usemap="#'+b.parent("map").attr("name")+'"]'),q=k.offset(),r={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10}},s=0,t=0,u;q.left+=Math.ceil((k.outerWidth()-k.width())/2),q.top+=Math.ceil((k.outerHeight()-k.height())/2);if(g==="poly"){s=i.length;while(s--)t=[parseInt(i[--s],10),parseInt(i[s+1],10)],t[0]>r.position.right&&(r.position.right=t[0]),t[0]<r.position.left&&(r.position.left=t[0]),t[1]>r.position.bottom&&(r.position.bottom=t[1]),t[1]<r.position.top&&(r.position.top=t[1]),j.push(t)}else{s=-1;while(s++<i.length)j.push(parseInt(i[s],10))}switch(g){case"rect":r={width:Math.abs(j[2]-j[0]),height:Math.abs(j[3]-j[1]),position:{left:Math.min(j[0],j[2]),top:Math.min(j[1],j[3])}};break;case"circle":r={width:j[2]+2,height:j[2]+2,position:{left:j[0],top:j[1]}};break;case"poly":r.width=Math.abs(r.position.right-r.position.left),r.height=Math.abs(r.position.bottom-r.position.top),c.abbrev()==="c"?r.position={left:r.position.left+r.width/2,top:r.position.top+r.height/2}:(f[c+h]||(r.position=v(r,j.slice(),c),e&&(e[0]==="flip"||e[1]==="flip")&&(r.offset=v(r,j.slice(),{x:c.x===m?o:c.x===o?m:p,y:c.y===l?n:c.y===n?l:p}),r.offset.left-=r.position.left,r.offset.top-=r.position.top),f[c+h]=r),r=f[c+h]),r.width=r.height=0}return r.position.left+=q.left,r.position.top+=q.top,r},u.bgiframe=function(a){var b=d.browser,c=a.plugins.bgiframe;return d("select, object").length<1||!b.msie||(""+b.version).charAt(0)!=="6"?f:"object"==typeof c?c:a.plugins.bgiframe=new P(a)},u.bgiframe.initialize="render"})})(window,document)
  4. ;function noty(a){var b=0,c={animateOpen:"animation.open",animateClose:"animation.close",easing:"animation.easing",speed:"animation.speed",onShow:"callback.onShow",onShown:"callback.afterShow",onClose:"callback.onClose",onClosed:"callback.afterClose"};return jQuery.each(a,function(d,e){if(c[d]){b++;var f=c[d].split(".");a[f[0]]||(a[f[0]]={}),a[f[0]][f[1]]=e?e:function(){},delete a[d]}}),a.closeWith||(a.closeWith=jQuery.noty.defaults.closeWith),a.hasOwnProperty("closeButton")&&(b++,a.closeButton&&a.closeWith.push("button"),delete a.closeButton),a.hasOwnProperty("closeOnSelfClick")&&(b++,a.closeOnSelfClick&&a.closeWith.push("click"),delete a.closeOnSelfClick),a.hasOwnProperty("closeOnSelfOver")&&(b++,a.closeOnSelfOver&&a.closeWith.push("hover"),delete a.closeOnSelfOver),a.hasOwnProperty("custom")&&(b++,a.custom.container!="null"&&(a.custom=a.custom.container)),a.hasOwnProperty("cssPrefix")&&(b++,delete a.cssPrefix),a.theme=="noty_theme_default"&&(b++,a.theme="defaultTheme"),a.hasOwnProperty("dismissQueue")||(a.layout=="topLeft"||a.layout=="topRight"||a.layout=="bottomLeft"||a.layout=="bottomRight"?a.dismissQueue=!0:a.dismissQueue=!1),a.buttons&&jQuery.each(a.buttons,function(a,c){c.click&&(b++,c.onClick=c.click,delete c.click),c.type&&(b++,c.addClass=c.type,delete c.type)}),b&&typeof console!="undefined"&&console.warn&&console.warn("You are using noty v2 with v1.x.x options. @deprecated until v2.2.0 - Please update your options."),jQuery.notyRenderer.init(a)}typeof Object.create!="function"&&(Object.create=function(a){function b(){}return b.prototype=a,new b}),function(a){var b={init:function(b){return this.options=a.extend({},a.noty.defaults,b),this.options.layout=this.options.custom?a.noty.layouts.inline:a.noty.layouts[this.options.layout],this.options.theme=a.noty.themes[this.options.theme],delete b.layout,delete b.theme,this.options=a.extend({},this.options,this.options.layout.options),this.options.id="noty_"+(new Date).getTime()*Math.floor(Math.random()*1e6),this.options=a.extend({},this.options,b),this._build(),this},_build:function(){var b=a('<div class="noty_bar"></div>').attr("id",this.options.id);b.append(this.options.template).find(".noty_text").html(this.options.text),this.$bar=this.options.layout.parent.object!==null?a(this.options.layout.parent.object).css(this.options.layout.parent.css).append(b):b;if(this.options.buttons){this.options.closeWith=[],this.options.timeout=!1;var c=a("<div/>").addClass("noty_buttons");this.options.layout.parent.object!==null?this.$bar.find(".noty_bar").append(c):this.$bar.append(c);var d=this;a.each(this.options.buttons,function(b,c){var e=a("<button/>").addClass(c.addClass?c.addClass:"gray").html(c.text).appendTo(d.$bar.find(".noty_buttons")).bind("click",function(){a.isFunction(c.onClick)&&c.onClick.call(e,d)})})}this.$message=this.$bar.find(".noty_message"),this.$closeButton=this.$bar.find(".noty_close"),this.$buttons=this.$bar.find(".noty_buttons"),a.noty.store[this.options.id]=this},show:function(){var b=this;return a(b.options.layout.container.selector).append(b.$bar),b.options.theme.style.apply(b),a.type(b.options.layout.css)==="function"?this.options.layout.css.apply(b.$bar):b.$bar.css(this.options.layout.css||{}),b.$bar.addClass(b.options.layout.addClass),b.options.layout.container.style.apply(a(b.options.layout.container.selector)),b.options.theme.callback.onShow.apply(this),a.inArray("click",b.options.closeWith)>-1&&b.$bar.css("cursor","pointer").one("click",function(){b.close()}),a.inArray("hover",b.options.closeWith)>-1&&b.$bar.one("mouseenter",function(){b.close()}),a.inArray("button",b.options.closeWith)>-1&&b.$closeButton.one("click",function(){b.close()}),a.inArray("button",b.options.closeWith)==-1&&b.$closeButton.remove(),b.options.callback.onShow&&b.options.callback.onShow.apply(b),b.$bar.animate(b.options.animation.open,b.options.animation.speed,b.options.animation.easing,function(){b.options.callback.afterShow&&b.options.callback.afterShow.apply(b),b.shown=!0}),b.options.timeout&&b.$bar.delay(b.options.timeout).promise().done(function(){b.close()}),this},close:function(){if(this.closed)return;var b=this;if(!this.shown){var c=[];a.each(a.noty.queue,function(a,d){d.options.id!=b.options.id&&c.push(d)}),a.noty.queue=c;return}b.$bar.addClass("i-am-closing-now"),b.options.callback.onClose&&b.options.callback.onClose.apply(b),b.$bar.clearQueue().stop().animate(b.options.animation.close,b.options.animation.speed,b.options.animation.easing,function(){b.options.callback.afterClose&&b.options.callback.afterClose.apply(b)}).promise().done(function(){b.options.modal&&(a.notyRenderer.setModalCount(-1),a.notyRenderer.getModalCount()==0&&a(".noty_modal").fadeOut("fast",function(){a(this).remove()})),a.notyRenderer.setLayoutCountFor(b,-1),a.notyRenderer.getLayoutCountFor(b)==0&&a(b.options.layout.container.selector).remove(),typeof b.$bar!="undefined"&&b.$bar!==null&&(b.$bar.remove(),b.$bar=null,b.closed=!0),delete a.noty.store[b.options.id],b.options.theme.callback.onClose.apply(b),b.options.dismissQueue||(a.noty.ontap=!0,a.notyRenderer.render())})},setText:function(a){return this.closed||(this.options.text=a,this.$bar.find(".noty_text").html(a)),this},setType:function(a){return this.closed||(this.options.type=a,this.options.theme.style.apply(this),this.options.theme.callback.onShow.apply(this)),this},setTimeout:function(a){if(!this.closed){var b=this;this.options.timeout=a,b.$bar.delay(b.options.timeout).promise().done(function(){b.close()})}return this},closed:!1,shown:!1};a.notyRenderer={},a.notyRenderer.init=function(c){var d=Object.create(b).init(c);return d.options.force?a.noty.queue.unshift(d):a.noty.queue.push(d),a.notyRenderer.render(),a.noty.returns=="object"?d:d.options.id},a.notyRenderer.render=function(){var b=a.noty.queue[0];a.type(b)==="object"?b.options.dismissQueue?a.notyRenderer.show(a.noty.queue.shift()):a.noty.ontap&&(a.notyRenderer.show(a.noty.queue.shift()),a.noty.ontap=!1):a.noty.ontap=!0},a.notyRenderer.show=function(b){b.options.modal&&(a.notyRenderer.createModalFor(b),a.notyRenderer.setModalCount(1)),a(b.options.layout.container.selector).length==0?b.options.custom?b.options.custom.append(a(b.options.layout.container.object).addClass("i-am-new")):a("body").append(a(b.options.layout.container.object).addClass("i-am-new")):a(b.options.layout.container.selector).removeClass("i-am-new"),a.notyRenderer.setLayoutCountFor(b,1),b.show()},a.notyRenderer.createModalFor=function(b){a(".noty_modal").length==0&&a("<div/>").addClass("noty_modal").data("noty_modal_count",0).css(b.options.theme.modal.css).prependTo(a("body")).fadeIn("fast")},a.notyRenderer.getLayoutCountFor=function(b){return a(b.options.layout.container.selector).data("noty_layout_count")||0},a.notyRenderer.setLayoutCountFor=function(b,c){return a(b.options.layout.container.selector).data("noty_layout_count",a.notyRenderer.getLayoutCountFor(b)+c)},a.notyRenderer.getModalCount=function(){return a(".noty_modal").data("noty_modal_count")||0},a.notyRenderer.setModalCount=function(b){return a(".noty_modal").data("noty_modal_count",a.notyRenderer.getModalCount()+b)},a.fn.noty=function(b){return b.custom=a(this),a.notyRenderer.init(b)},a.noty={},a.noty.queue=[],a.noty.ontap=!0,a.noty.layouts={},a.noty.themes={},a.noty.returns="object",a.noty.store={},a.noty.get=function(b){return a.noty.store.hasOwnProperty(b)?a.noty.store[b]:!1},a.noty.close=function(b){return a.noty.get(b)?a.noty.get(b).close():!1},a.noty.setText=function(b,c){return a.noty.get(b)?a.noty.get(b).setText(c):!1},a.noty.setType=function(b,c){return a.noty.get(b)?a.noty.get(b).setType(c):!1},a.noty.clearQueue=function(){a.noty.queue=[]},a.noty.closeAll=function(){a.noty.clearQueue(),a.each(a.noty.store,function(a,b){b.close()})};var c=window.alert;a.noty.consumeAlert=function(b){window.alert=function(c){b?b.text=c:b={text:c},a.notyRenderer.init(b)}},a.noty.stopConsumeAlert=function(){window.alert=c},a.noty.defaults={layout:"top",theme:"defaultTheme",type:"alert",text:"",dismissQueue:!0,template:'<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',animation:{open:{height:"toggle"},close:{height:"toggle"},easing:"swing",speed:500},timeout:!1,force:!1,modal:!1,closeWith:["click"],callback:{onShow:function(){},afterShow:function(){},onClose:function(){},afterClose:function(){}},buttons:!1},a(window).resize(function(){a.each(a.noty.layouts,function(b,c){c.container.style.apply(a(c.container.selector))})})}(jQuery)
  5. ;(function(a){a.noty.layouts.bottomRight={name:"bottomRight",options:{},container:{object:'<ul id="noty_bottomRight_layout_container" />',selector:"ul#noty_bottomRight_layout_container",style:function(){a(this).css({bottom:0,right:60,position:"fixed",width:"200px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e4}),window.innerWidth<600&&a(this).css({right:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"200px"},addClass:""}})(jQuery)
  6. ;(function(a){a.noty.layouts.bottomRightPoint={name:"bottomRightPoint",options:{},container:{object:'<ul id="noty_bottomRightPoint_layout_container" />',selector:"ul#noty_bottomRightPoint_layout_container",style:function(){a(this).css({bottom:0,right:347,position:"fixed",width:"50px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e5}),window.innerWidth<600&&a(this).css({right:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"50px"},addClass:""}})(jQuery)
  7. ;(function(a){a.noty.themes.defaultTheme={name:"defaultTheme",helpers:{borderFix:function(){if(this.options.dismissQueue){var b=this.options.layout.container.selector+" "+this.options.layout.parent.selector;switch(this.options.layout.name){case"top":a(b).css({borderRadius:"0px 0px 0px 0px"}),a(b).last().css({borderRadius:"0px 0px 5px 5px"});break;case"topCenter":case"topLeft":case"topRight":case"bottomCenter":case"bottomLeft":case"bottomRight":case"bottomRightPoint":case"center":case"centerLeft":case"centerRight":case"inline":a(b).first().css({"border-top-left-radius":"5px","border-top-right-radius":"5px"}),a(b).last().css({"border-bottom-left-radius":"0px","border-bottom-right-radius":"0px"});break;case"bottom":a(b).css({borderRadius:"0px 0px 0px 0px"}),a(b).first().css({borderRadius:"5px 5px 0px 0px"});break;default:}}}},modal:{css:{position:"fixed",width:"100%",height:"100%",backgroundColor:"#000",zIndex:1e4,opacity:.6,display:"none",left:0,top:0}},style:function(){this.$bar.css({overflow:"hidden",background:"#EDEDED"}),this.$message.css({fontSize:"13px",lineHeight:"16px",textAlign:"center",padding:"8px 10px 9px",width:"auto",position:"relative"}),this.$closeButton.css({position:"absolute",top:4,right:4,width:10,height:10,background:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAATpJREFUeNoszrFqVFEUheG19zlz7sQ7ijMQBAvfYBqbpJCoZSAQbOwEE1IHGytbLQUJ8SUktW8gCCFJMSGSNxCmFBJO7j5rpXD6n5/P5vM53H3b3T9LOiB5AQDuDjM7BnA7DMPHDGBH0nuSzwHsRcRVRNRSysuU0i6AOwA/02w2+9Fae00SEbEh6SGAR5K+k3zWWptKepCm0+kpyRoRGyRBcpPkDsn1iEBr7drdP2VJZyQXERGSPpiZAViTBACXKaV9kqd5uVzCzO5KKb/d/UZSDwD/eyxqree1VqSu6zKAF2Z2RPJJaw0rAkjOJT0m+SuT/AbgDcmnkmBmfwAsJL1dXQ8lWY6IGwB1ZbrOOb8zs8thGP4COFwx/mE8Ho9Go9ErMzvJOW/1fY/JZIJSypqZfXX3L13X9fcDAKJct1sx3OiuAAAAAElFTkSuQmCC)",display:"none",cursor:"pointer"}),this.$buttons.css({padding:5,textAlign:"right",borderTop:"1px solid #ccc",backgroundColor:"#fff"}),this.$buttons.find("button").css({marginLeft:5}),this.$buttons.find("button:first").css({marginLeft:0}),this.$bar.bind({mouseenter:function(){a(this).find(".noty_close").fadeIn()},mouseleave:function(){a(this).find(".noty_close").fadeOut()}});switch(this.options.layout.name){case"top":this.$bar.css({borderRadius:"0px 0px 5px 5px",borderBottom:"2px solid #eee",borderLeft:"2px solid #eee",borderRight:"2px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"});break;case"topCenter":case"center":case"bottomCenter":case"inline":this.$bar.css({borderRadius:"5px",border:"1px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}),this.$message.css({fontSize:"13px",textAlign:"center"});break;case"topLeft":case"topRight":case"bottomLeft":case"bottomRight":case"bottomRightPoint":case"centerLeft":case"centerRight":this.$bar.css({borderRadius:"5px 5px 0px 0px",border:"1px solid #eee",borderBottom:"0px",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}),this.$message.css({fontSize:"13px",textAlign:"left"});break;case"bottom":this.$bar.css({borderRadius:"5px 5px 0px 0px",borderTop:"2px solid #eee",borderLeft:"2px solid #eee",borderRight:"2px solid #eee",boxShadow:"0 -2px 4px rgba(0, 0, 0, 0.1)"});break;default:this.$bar.css({border:"2px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"})}switch(this.options.type){case"alert":case"notification":this.$bar.css({backgroundColor:"#FFF",borderColor:"#CCC",color:"#444"});break;case"warning":this.$bar.css({backgroundColor:"#FFEAA8",borderColor:"#FFC237",color:"#826200"}),this.$buttons.css({borderTop:"1px solid #FFC237"});break;case"error":this.$bar.css({backgroundColor:"red",borderColor:"darkred",color:"#FFF"}),this.$message.css({fontWeight:"bold"}),this.$buttons.css({borderTop:"1px solid darkred"});break;case"information":this.$bar.css({backgroundColor:"#57B7E2",borderColor:"#0B90C4",color:"#FFF"}),this.$buttons.css({borderTop:"1px solid #0B90C4"});break;case"success":this.$bar.css({backgroundColor:"lightgreen",borderColor:"#50C24E",color:"darkgreen"}),this.$buttons.css({borderTop:"1px solid #50C24E"});break;default:this.$bar.css({backgroundColor:"#FFF",borderColor:"#CCC",color:"#444"})}},callback:{onShow:function(){a.noty.themes.defaultTheme.helpers.borderFix.apply(this)},onClose:function(){a.noty.themes.defaultTheme.helpers.borderFix.apply(this)}}}})(jQuery)
  8. ;function PointNotify(){}PointNotify.AddedPointNotify=function(a){if(a>0)var b=noty({text:'Bạn có <b style="color:#06a703;">+'+a+" điểm</b> chờ duyệt!",type:"Information",dismissQueue:!0,layout:"bottomRight",theme:"defaultTheme",timeout:1e4})},PointNotify.RemovedPointNotify=function(a){if(a>0)var b=noty({text:'Bạn đã bị <b style="color:#cc0000;">-'+a+" điểm</b>!",type:"Information",dismissQueue:!0,layout:"bottomRight",theme:"defaultTheme",timeout:1e4})}
  9. ;function generateNotification(){$.get("/account/RunAddNotification",function(a){!a.success})}function GetNewsCount(){if(!isviewingnotification){var a=new Date;$.get("/notification/GetNewsCount?t="+a.getTime(),function(a){if(a.success){var b=a.newscount;b>0?($("#newscount").text(b),$("#newscount").removeClass("notification-new-none").addClass("notification-new-have")):($("#newscount").text(""),$("#newscount").removeClass("notification-new-have").addClass("notification-new-none")),$("#newscount").attr("token",a.token)}})}}function checkHideOrShowNotification(){$("#notificationsFlyout").hover(function(){mouse_is_inside=!0},function(){mouse_is_inside=!1}),$("#newscount").hover(function(){mouse_is_inside=!0},function(){mouse_is_inside=!1}),$("body").mouseup(function(){mouse_is_inside||($("#notificationsFlyout").hide(),$(".notificationBox span.arrow").hide(),isviewingnotification=!1)})}function requestFriendListScroll(){$("#notification-request-friend").scroll(function(){notificationModel.requestFriendList.loadData()})}var RequestFriendListModel=function(a){var b=this;b.requests=ko.observableArray(a.Requests),b.totalRemaining=ko.observable(a.TotalRemaining),b.lastId=ko.observable(a.LastId),b.loading=ko.observable(!1),b.loadData=function(){if(b.totalRemaining()>0&&!b.loading()){b.loading(!0);var a=new Date;$.get("/Notification/GetFriendRequestNotification?lastId="+b.lastId()+"&t="+a.getTime(),function(a){if(a.success){for(var c=0;c<a.data.Requests.length;c++)b.requests.push(a.data.Requests[c]);b.lastId(a.data.LastId),b.totalRemaining(a.data.TotalRemaining)}b.loading(!1)})}}},NotificationsModel=function(a){var b=this;b.requestFriendList=new RequestFriendListModel(a.RequestFriendList),b.notifications=ko.observableArray(a.Notifications),b.lastId=ko.observable(a.LastId),b.currentTime=a.CurrentTime,b.totalRequestFriend=ko.observable(a.TotalRequestFriend),b.totalNotifications=ko.observable(a.TotalNotifications),b.pageSize=a.PageSize,b.isLoadingMore=ko.observable(!1),b.acceptFriend=function(a){var c={friendid:a.UserId};$.post("/friend/acceptaddfriend?nonHtml=true",c,function(c){c.success&&b.updatedRequestFriendList(a)})},b.cancelFriend=function(a){var c={friendid:a.UserId};$.post("/friend/canceladdfriend?nonHtml=true",c,function(c){c.success&&b.updatedRequestFriendList(a)})},b.updatedRequestFriendList=function(a){for(var c=0;c<b.requestFriendList.requests().length;c++)if(b.requestFriendList.requests()[c].UserId==a.UserId){b.requestFriendList.requests.splice(c,1),b.totalRequestFriend(b.totalRequestFriend()-1);break}b.requestFriendList.requests().length==0&&b.showShortBox()},b.showDetailBox=function(a){b.requestFriendList.loadData(),$("#short-box").hide(),$("#"+a.UserId).effect("highlight",{},3e3),$("#detail-box").show()},b.showShortBox=function(){$("#detail-box").hide(),$("#short-box").show()},b.loadMore=function(){var a=b.pageIndex+1;if(b.totalNotifications()-b.pageSize>0&&!b.isLoadingMore()){b.isLoadingMore(!0);var c=new Date;$.get("/notification/GetNotifications?lastId="+b.lastId()+"&t="+c.getTime(),function(a){if(a.success){for(var c=0;c<a.data.Notifications.length;c++)b.notifications.push(a.data.Notifications[c]);b.totalNotifications(a.data.Total),b.lastId(a.data.LastId),b.calculateNotificationPostedTime()}b.isLoadingMore(!1)})}},b.calculateNotificationPostedTime=function(){var a=parseInt(b.currentTime);$(".notification-posted-time").each(function(c,d){var e=parseInt($(this).attr("utime")),f=b.getDiffTime(a-e);f==0||f==""?$(this).text($(this).attr("title")):($(this).text(f),$(this).fadeIn())})},b.topRequestFriendList=ko.computed(function(){var a=[],c=Math.min(5,b.requestFriendList.requests().length);for(var d=0;d<c;d++)a.push(b.requestFriendList.requests()[d]);return a}),b.getDiffTime=function(a){var b="";return a<60?b=CommonText.PostedTime_AFewSecondsAgo:a<120?b=CommonText.PostedTime_About1MinuteAgo:a<3600?b=Math.floor(a/60)+" "+CommonText.PostedTime_MinutesAgo:a<7200?b=CommonText.PostedTime_About1HourAgo:a<86400&&(b=Math.floor(a/3600)+" "+CommonText.PostedTime_HoursAgo),b},b.setUpdatedTime=function(a){setInterval(function(){b.currentTime+=a/1e3,b.calculateNotificationPostedTime()},a)},b.getDetailLink=function(a){var b="";switch(a.Type){case 1:break;case 2:case 15:b=a.Senders[0].ProfileUrl;break;case 3:case 4:case 5:b=a.Url;break;case 7:b="http://www.foody.vn";break;case 8:b=a.Url;break;case 9:case 10:b=a.Url;break;case 6:case 11:b=a.Url;break;case 12:case 13:case 14:case 16:case 17:case 18:case 19:b=a.Url}return b}};$(function(){$("#notifications-box-container").scroll(function(){$("#notifications-box-container")[0].scrollHeight*1/4<$("#notifications-box-container").scrollTop()&&(notificationModel.isLoadingMore()||notificationModel.loadMore())}),$(".addNotification").click(function(){$.get("/account/RunAddNotification",function(a){a.success&&alert("ngon")})})});var isviewingnotification=!1;$("#newscount").live("click",function(){if(!$("#notificationsFlyout").is(":visible")){isviewingnotification=!0,$("#detail-box").hide(),$("#short-box").show(),$("#notificationsFlyout").show(),$(".notificationBox span.arrow").show();var a=$(this).attr("token");if(a!=""&&notificationModel==null){$("#notify-loading").show(),$(".notify-content").hide();var b=new Date;$.get("/notification/notifications?t="+b.getTime(),function(c){c.success&&($.get("/notification/updateasviewed?token="+a+"&t="+b.getTime(),function(a){a.success&&($("#newscount").removeClass("notification-new-have").addClass("notification-new-none"),$("#newscount").text(""))}),notificationModel=new NotificationsModel(c.data),ko.applyBindings(notificationModel,document.getElementById("notificationsFlyout")),notificationModel.calculateNotificationPostedTime(),notificationModel.setUpdatedTime(5e3),requestFriendListScroll()),$("#notify-loading").hide(),$("#notify-box").show(),$(".notify-content").show()})}}else $("#notificationsFlyout").hide(),$(".notificationBox span.arrow").hide(),isviewingnotification=!1});var notificationModel=null,mouse_is_inside=!1;NotificationsModel.Init=function(){GetNewsCount(),checkHideOrShowNotification()},$(".header-link-to-facebook").live("click",function(){LinkToFacebook(function(){window.location.reload()})}),$("._pop1 ._pop_close").live("click",function(){var a=new Date;$.get("/Notification/CloseFacebookConnectNotify?t="+a.getTime(),function(a){$("._pop1").hide()})}),$("#go-lists").live("click",function(){$.get("/Member/GetListsPageUrl",function(a){a.success&&(window.location.href=a.link)})}),$("._pop2 ._pop_close").live("click",function(){var a=new Date;$.get("/Member/CloseSuggestUsingList?t="+a.getTime(),function(a){$("._pop2").hide()})}),$("#topNo ._pop_close").live("click",function(){var a=new Date;$.get("/Notification/CloseGeneralNotify?t="+a.getTime(),function(a){$("#topNo").hide(),$("section:first").css("padding-top",0);var b=$("section:first").attr("class");b=="maincontent"&&$("div.banner").css("top",46),$(".district-banner").css("padding-top",46)})}),$("._pop3 ._pop_close").live("click",function(){var a=new Date;$.get("/Notification/CloseReviewTip?t="+a.getTime(),function(a){$("._pop3").hide()})}),$("._pop3 #btnok").live("click",function(){var a=new Date;$.get("/Notification/CloseReviewTip?t="+a.getTime(),function(a){$("._pop3").hide()})})
  10. ;/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
  11.  * Licensed under the MIT License (LICENSE.txt).
  12.  *
  13.  * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
  14.  * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
  15.  * Thanks to: Seamus Leahy for adding deltaX and deltaY
  16.  *
  17.  * Version: 3.0.6
  18.  *
  19.  * Requires: 1.2.2+
  20.  */
  21. (function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery)
  22.  
  23. ;(function(a){var b={init:function(b){function d(){return"ontouchstart"in window?1:0}var c={set_width:!1,set_height:!1,horizontalScroll:!1,scrollInertia:550,scrollEasing:"easeOutCirc",mouseWheel:"auto",autoDraggerLength:!0,scrollButtons:{enable:!1,scrollType:"continuous",scrollSpeed:20,scrollAmount:40},advanced:{updateOnBrowserResize:!0,updateOnContentResize:!1,autoExpandHorizontalScroll:!1},callbacks:{onScroll:function(){},onTotalScroll:function(){},onTotalScrollOffset:0}},b=a.extend(!0,c,b);return a(document).data("mCS-is-touch-device",!1),d()&&a(document).data("mCS-is-touch-device",!0),this.each(function(){var c=a(this);b.set_width&&c.css("width",b.set_width),b.set_height&&c.css("height",b.set_height);if(!a(document).data("mCustomScrollbar-index"))a(document).data("mCustomScrollbar-index","1");else{var e=parseInt(a(document).data("mCustomScrollbar-index"));a(document).data("mCustomScrollbar-index",e+1)}c.wrapInner("<div class='mCustomScrollBox' style='position:relative; height:100%; overflow:hidden; max-width:100%;' />").addClass("mCustomScrollbar _mCS_"+a(document).data("mCustomScrollbar-index"));var f=c.children(".mCustomScrollBox");if(b.horizontalScroll){f.addClass("mCSB_horizontal").wrapInner("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />");var g=f.children(".mCSB_h_wrapper");g.wrapInner("<div class='mCSB_container' style='position:absolute; left:0;' />").children(".mCSB_container").css({width:g.children().outerWidth(),position:"relative"}).unwrap()}else f.wrapInner("<div class='mCSB_container' style='position:relative; top:0;' />");var h=f.children(".mCSB_container");if(!a(document).data("mCS-is-touch-device")){h.after("<div class='mCSB_scrollTools' style='position:absolute;'><div class='mCSB_draggerContainer' style='position:relative;'><div class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' style='position:relative;'></div></div><div class='mCSB_draggerRail'></div></div></div>");var i=f.children(".mCSB_scrollTools"),j=i.children(".mCSB_draggerContainer"),k=j.children(".mCSB_dragger");b.horizontalScroll?k.data("minDraggerWidth",k.width()):k.data("minDraggerHeight",k.height()),b.scrollButtons.enable&&(b.horizontalScroll?i.prepend("<a class='mCSB_buttonLeft' style='display:block; position:relative;'></a>").append("<a class='mCSB_buttonRight' style='display:block; position:relative;'></a>"):i.prepend("<a class='mCSB_buttonUp' style='display:block; position:relative;'></a>").append("<a class='mCSB_buttonDown' style='display:block; position:relative;'></a>")),f.bind("scroll",function(){f.scrollTop(0).scrollLeft(0)}),c.data({horizontalScroll:b.horizontalScroll,scrollInertia:b.scrollInertia,scrollEasing:b.scrollEasing,mouseWheel:b.mouseWheel,autoDraggerLength:b.autoDraggerLength,"scrollButtons-enable":b.scrollButtons.enable,"scrollButtons-scrollType":b.scrollButtons.scrollType,"scrollButtons-scrollSpeed":b.scrollButtons.scrollSpeed,"scrollButtons-scrollAmount":b.scrollButtons.scrollAmount,autoExpandHorizontalScroll:b.advanced.autoExpandHorizontalScroll,"onScroll-Callback":b.callbacks.onScroll,"onTotalScroll-Callback":b.callbacks.onTotalScroll,"onTotalScroll-Offset":b.callbacks.onTotalScrollOffset}).mCustomScrollbar("update");if(b.advanced.updateOnBrowserResize){var l;a(window).resize(function(){l&&clearTimeout(l),l=setTimeout(function(){c.mCustomScrollbar("update")},150)})}}else f.css({overflow:"auto","-webkit-overflow-scrolling":"touch"}),h.addClass("mCS_no_scrollbar mCS_touch"),c.data({horizontalScroll:b.horizontalScroll,scrollInertia:b.scrollInertia,scrollEasing:b.scrollEasing,autoExpandHorizontalScroll:b.advanced.autoExpandHorizontalScroll,"onScroll-Callback":b.callbacks.onScroll,"onTotalScroll-Callback":b.callbacks.onTotalScroll,"onTotalScroll-Offset":b.callbacks.onTotalScrollOffset}),f.scroll(function(){c.mCustomScrollbar("callbacks",f,h)});if(b.advanced.updateOnContentResize){var m;if(b.horizontalScroll){var n=h.outerWidth();d()&&f.css({"-webkit-overflow-scrolling":"auto"})}else var n=h.outerHeight();m=setInterval(function(){if(b.horizontalScroll){b.advanced.autoExpandHorizontalScroll&&h.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:h.outerWidth(),position:"relative"}).unwrap();var a=h.outerWidth()}else var a=h.outerHeight();a!=n&&(c.mCustomScrollbar("update"),n=a)},300)}})},update:function(){var b=a(this),c=b.children(".mCustomScrollBox"),d=c.children(".mCSB_container");a(document).data("mCS-is-touch-device")||d.removeClass("mCS_no_scrollbar");var e=c.children(".mCSB_scrollTools"),f=e.children(".mCSB_draggerContainer"),g=f.children(".mCSB_dragger");if(b.data("horizontalScroll")){var h=e.children(".mCSB_buttonLeft"),i=e.children(".mCSB_buttonRight"),j=c.width();b.data("autoExpandHorizontalScroll")&&d.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:d.outerWidth(),position:"relative"}).unwrap();var k=d.outerWidth()}else var l=e.children(".mCSB_buttonUp"),m=e.children(".mCSB_buttonDown"),n=c.height(),o=d.outerHeight();if(o>n&&!b.data("horizontalScroll")&&!a(document).data("mCS-is-touch-device")){e.css("display","block");var p=f.height();if(b.data("autoDraggerLength")){var q=Math.round(o-(o-n)*1.3),r=g.data("minDraggerHeight");if(q<=r)g.css({height:r});else if(q>=p-10){var s=p-10;g.css({height:s})}else g.css({height:q});g.children(".mCSB_dragger_bar").css({"line-height":g.height()+"px"})}var t=g.height(),u=(o-n)/(p-t);b.data("scrollAmount",u),b.mCustomScrollbar("scrolling",c,d,f,g,l,m,h,i),g.position().top>p-t&&g.css("top",p-t),b.mCustomScrollbar("scroll",!0)}else if(k>j&&b.data("horizontalScroll")&&!a(document).data("mCS-is-touch-device")){e.css("display","block");var v=f.width();if(b.data("autoDraggerLength")){var w=Math.round(k-(k-j)*1.3),x=g.data("minDraggerWidth");if(w<=x)g.css({width:x});else if(w>=v-10){var y=v-10;g.css({width:y})}else g.css({width:w})}var z=g.width(),u=(k-j)/(v-z);b.data("scrollAmount",u),b.mCustomScrollbar("scrolling",c,d,f,g,l,m,h,i),g.position().left>v-z&&g.css("left",v-z),b.mCustomScrollbar("scroll",!0)}else c.unbind("mousewheel"),c.unbind("focusin"),b.data("horizontalScroll")?g.add(d).css("left",0):g.add(d).css("top",0),e.css("display","none"),d.addClass("mCS_no_scrollbar")},scrolling:function(b,c,d,e,f,g,h,i){var j=a(this);if(!e.hasClass("ui-draggable")){if(j.data("horizontalScroll"))var k="x";else var k="y";e.draggable({axis:k,containment:"parent",drag:function(a,b){j.mCustomScrollbar("scroll"),e.addClass("mCSB_dragger_onDrag")},stop:function(a,b){e.removeClass("mCSB_dragger_onDrag")}})}d.unbind("click").bind("click",function(a){if(j.data("horizontalScroll")){var b=a.pageX-d.offset().left;if(b<e.position().left||b>e.position().left+e.width()){var c=b;c>=d.width()-e.width()&&(c=d.width()-e.width()),e.css("left",c),j.mCustomScrollbar("scroll")}}else{var b=a.pageY-d.offset().top;if(b<e.position().top||b>e.position().top+e.height()){var c=b;c>=d.height()-e.height()&&(c=d.height()-e.height()),e.css("top",c),j.mCustomScrollbar("scroll")}}});if(j.data("mouseWheel")){var l=j.data("mouseWheel");if(j.data("mouseWheel")==="auto"){l=8;var m=navigator.userAgent;m.indexOf("Mac")!=-1&&m.indexOf("Safari")!=-1&&m.indexOf("AppleWebKit")!=-1&&m.indexOf("Chrome")==-1&&(l=1)}b.unbind("mousewheel").bind("mousewheel",function(a,b){a.preventDefault();var c=Math.abs(b*l);if(j.data("horizontalScroll")){var f=e.position().left-b*c;e.css("left",f),e.position().left<0&&e.css("left",0);var g=d.width(),h=e.width();e.position().left>g-h&&e.css("left",g-h)}else{var i=e.position().top-b*c;e.css("top",i),e.position().top<0&&e.css("top",0);var k=d.height(),m=e.height();e.position().top>k-m&&e.css("top",k-m)}j.mCustomScrollbar("scroll")})}if(j.data("scrollButtons-enable"))if(j.data("scrollButtons-scrollType")==="pixels"){var n;a.browser.msie&&parseInt(a.browser.version)<9&&j.data("scrollInertia",0),j.data("horizontalScroll")?(i.add(h).unbind("click mousedown mouseup mouseout",r,t),i.bind("click",function(a){a.preventDefault(),c.is(":animated")||(n=Math.abs(c.position().left)+j.data("scrollButtons-scrollAmount"),j.mCustomScrollbar("scrollTo",n))}),h.bind("click",function(a){a.preventDefault(),c.is(":animated")||(n=Math.abs(c.position().left)-j.data("scrollButtons-scrollAmount"),c.position().left>=-j.data("scrollButtons-scrollAmount")&&(n="left"),j.mCustomScrollbar("scrollTo",n))})):(g.add(f).unbind("click mousedown mouseup mouseout",x,z),g.bind("click",function(a){a.preventDefault(),c.is(":animated")||(n=Math.abs(c.position().top)+j.data("scrollButtons-scrollAmount"),j.mCustomScrollbar("scrollTo",n))}),f.bind("click",function(a){a.preventDefault(),c.is(":animated")||(n=Math.abs(c.position().top)-j.data("scrollButtons-scrollAmount"),c.position().top>=-j.data("scrollButtons-scrollAmount")&&(n="top"),j.mCustomScrollbar("scrollTo",n))}))}else if(j.data("horizontalScroll")){i.add(h).unbind("click mousedown mouseup mouseout",r,t);var o,p=d.width(),q=e.width();i.bind("mousedown",function(a){a.preventDefault();var b=p-q;o=setInterval(function(){var a=Math.abs(e.position().left-b)*(100/j.data("scrollButtons-scrollSpeed"));e.stop().animate({left:b},a,"linear"),j.mCustomScrollbar("scroll")},20)});var r=function(a){a.preventDefault(),clearInterval(o),e.stop()};i.bind("mouseup mouseout",r);var s;h.bind("mousedown",function(a){a.preventDefault();var b=0;s=setInterval(function(){var a=Math.abs(e.position().left-b)*(100/j.data("scrollButtons-scrollSpeed"));e.stop().animate({left:b},a,"linear"),j.mCustomScrollbar("scroll")},20)});var t=function(a){a.preventDefault(),clearInterval(s),e.stop()};h.bind("mouseup mouseout",t)}else{g.add(f).unbind("click mousedown mouseup mouseout",x,z);var u,v=d.height(),w=e.height();g.bind("mousedown",function(a){a.preventDefault();var b=v-w;u=setInterval(function(){var a=Math.abs(e.position().top-b)*(100/j.data("scrollButtons-scrollSpeed"));e.stop().animate({top:b},a,"linear"),j.mCustomScrollbar("scroll")},20)});var x=function(a){a.preventDefault(),clearInterval(u),e.stop()};g.bind("mouseup mouseout",x);var y;f.bind("mousedown",function(a){a.preventDefault();var b=0;y=setInterval(function(){var a=Math.abs(e.position().top-b)*(100/j.data("scrollButtons-scrollSpeed"));e.stop().animate({top:b},a,"linear"),j.mCustomScrollbar("scroll")},20)});var z=function(a){a.preventDefault(),clearInterval(y),e.stop()};f.bind("mouseup mouseout",z)}b.unbind("focusin").bind("focusin",function(){b.scrollTop(0).scrollLeft(0);var f=a(document.activeElement);if(f.is("input,textarea,select,button,a,area,object"))if(j.data("horizontalScroll")){var g=c.position().left,h=f.position().left,i=b.width(),k=f.outerWidth();if(!(g+h>=0&&g+h<=i-k)){var l=h/j.data("scrollAmount");l>=d.width()-e.width()&&(l=d.width()-e.width()),e.css("left",l),j.mCustomScrollbar("scroll")}}else{var m=c.position().top,n=f.position().top,o=b.height(),p=f.outerHeight();if(!(m+n>=0&&m+n<=o-p)){var l=n/j.data("scrollAmount");l>=d.height()-e.height()&&(l=d.height()-e.height()),e.css("top",l),j.mCustomScrollbar("scroll")}}})},scroll:function(b){var c=a(this),d=c.find(".mCSB_dragger"),e=c.find(".mCSB_container"),f=c.find(".mCustomScrollBox");if(c.data("horizontalScroll"))var g=d.position().left,h=-g*c.data("scrollAmount"),i=e.position().left,j=Math.round(i-h);else var k=d.position().top,l=-k*c.data("scrollAmount"),m=e.position().top,n=Math.round(m-l);if(a.browser.webkit)var o=(window.outerWidth-8)/window.innerWidth,p=o<.98||o>1.02;c.data("scrollInertia")===0||p?(c.data("horizontalScroll")?e.css("left",h):e.css("top",l),b||c.mCustomScrollbar("callbacks",f,e)):c.data("horizontalScroll")?e.stop().animate({left:"-="+j},c.data("scrollInertia"),c.data("scrollEasing"),function(){b||c.mCustomScrollbar("callbacks",f,e)}):e.stop().animate({top:"-="+n},c.data("scrollInertia"),c.data("scrollEasing"),function(){b||c.mCustomScrollbar("callbacks",f,e)})},scrollTo:function(b,c){var d={moveDragger:!1,callback:!0},c=a.extend(d,c),e=a(this),f,g=e.find(".mCustomScrollBox"),h=g.children(".mCSB_container");if(!a(document).data("mCS-is-touch-device"))var i=e.find(".mCSB_draggerContainer"),j=i.children(".mCSB_dragger");var k;if(b){if(typeof b=="number")c.moveDragger?f=b:(k=b,f=Math.round(k/e.data("scrollAmount")));else if(typeof b=="string"){var l;b==="top"?l=0:b==="bottom"&&!e.data("horizontalScroll")?l=h.outerHeight()-g.height():b==="left"?l=0:b==="right"&&e.data("horizontalScroll")?l=h.outerWidth()-g.width():b==="first"?l=e.find(".mCSB_container").find(":first"):b==="last"?l=e.find(".mCSB_container").find(":last"):l=e.find(b),l.length===1?(e.data("horizontalScroll")?k=l.position().left:k=l.position().top,a(document).data("mCS-is-touch-device")?f=k:f=Math.ceil(k/e.data("scrollAmount"))):f=l}a(document).data("mCS-is-touch-device")?e.data("horizontalScroll")?g.stop().animate({scrollLeft:f},e.data("scrollInertia"),e.data("scrollEasing"),function(){c.callback&&e.mCustomScrollbar("callbacks",g,h)}):g.stop().animate({scrollTop:f},e.data("scrollInertia"),e.data("scrollEasing"),function(){c.callback&&e.mCustomScrollbar("callbacks",g,h)}):(e.data("horizontalScroll")?(f>=i.width()-j.width()&&(f=i.width()-j.width()),j.css("left",f)):(f>=i.height()-j.height()&&(f=i.height()-j.height()),j.css("top",f)),c.callback?e.mCustomScrollbar("scroll"):e.mCustomScrollbar("scroll",!0))}},callbacks:function(b,c){var d=a(this);if(!a(document).data("mCS-is-touch-device"))if(d.data("horizontalScroll")){var e=Math.round(c.position().left);e<0&&e<=b.width()-c.outerWidth()+d.data("onTotalScroll-Offset")?d.data("onTotalScroll-Callback").call():d.data("onScroll-Callback").call()}else{var f=Math.round(c.position().top);f<0&&f<=b.height()-c.outerHeight()+d.data("onTotalScroll-Offset")?d.data("onTotalScroll-Callback").call():d.data("onScroll-Callback").call()}else if(d.data("horizontalScroll")){var g=Math.round(b.scrollLeft());g>0&&g>=c.outerWidth()-d.width()-d.data("onTotalScroll-Offset")?d.data("onTotalScroll-Callback").call():d.data("onScroll-Callback").call()}else{var h=Math.round(b.scrollTop());h>0&&h>=c.outerHeight()-d.height()-d.data("onTotalScroll-Offset")?d.data("onTotalScroll-Callback").call():d.data("onScroll-Callback").call()}}};a.fn.mCustomScrollbar=function(c){if(b[c])return b[c].apply(this,Array.prototype.slice.call(arguments,1));if(typeof c=="object"||!c)return b.init.apply(this,arguments);a.error("Method "+c+" does not exist")}})(jQuery)
  24. ;function AutoCompleteMode(a,b,c){var d=this;d.inputElement=$(a),d.panel=$(b),d.options=c||{},d.options.minLength=c.minLength||2,d.options.delay=c.delay||300,d.options.showImg=ko.observable(c.showImg),d.options.showAddress=ko.observable(c.showAddress),d.options.goDetailsOnSelect=ko.observable(c.goDetailsOnSelect),d.options.detailsLinkText=ko.observable(c.detailsLinkText||"Details"),d.options.viewMoreLinkText=ko.observable(c.viewMoreLinkText||"View more"),d.options.closedLinkText=ko.observable(c.closedLinkText||"Closed"),d.currentIndex=ko.observable(-1),d.isShow=ko.observable(!1),d.items=ko.observableArray([]),d.selectItem=function(a,b){d.inputElement.data("keyword",a.name),d.inputElement.val(a.name),d.isShow(!1),a.type!="restaurant"?d.options.onItemSelected&&d.options.onItemSelected(a,b):b.which!=13&&d.options.goDetailsOnSelect()||a.city||b.target.className=="foo-au-item-details-link"||b.target.className=="foo-au-item-img"?location.href=a.link:(d.isShow(!1),d.options.onItemSelected&&d.options.onItemSelected(a,b))},d.refreshPanel=function(){var b=d.inputElement.offset(),c=b.left+(d.options.offsetLeft||0),e=b.top+a.height()+parseInt(d.inputElement.css("padding-top"))+parseInt(d.inputElement.css("padding-bottom"))+parseInt(d.inputElement.css("border-top-width"))+parseInt(d.inputElement.css("border-bottom-width")+1)+(d.options.offsetTop||0),f=a.width()+parseInt(d.inputElement.css("padding-left"))+parseInt(d.inputElement.css("padding-right"))+parseInt(d.inputElement.css("border-left-width"))+parseInt(d.inputElement.css("border-right-width"))+(d.options.offsetWidth||0);d.panel.width(f).offset({top:e,left:c})},d.hoverItem=function(a,b){a.selected(!1),d.currentIndex(-1)},d.keyword=ko.computed(function(){if(d.currentIndex()>=0){var b=d.items()[d.currentIndex()].name;return d.inputElement.data("keyword")||d.inputElement.data("keyword",d.inputElement.val()),a.val(b),b}return userInput=d.inputElement.data("keyword"),d.inputElement.data("keyword",""),userInput&&a.val(userInput),userInput}),d.categories=ko.computed(function(){var a={};for(var b=0;b<d.items().length;b++){var c=d.items()[b];a[c.category]||(a[c.category]={name:c.category,categoryIcon:c.categoryIcon,categoryLink:c.categoryLink,hasMoreItem:ko.observable(c.hasMoreItem),items:[]}),a[c.category].items.push(c)}var e=[];for(var f in a)e.push(a[f]);return e.length>0&&(d.isShow(!0),d.refreshPanel()),e}),d.lastAjax=null,d.lastLoadTimer=0,d.filterKeyword=function(a,b){if(b.which==8||b.which==9||b.which==13||b.which==16||b.which==17||b.which==18||b.which==19||b.which==20||b.which==27||b.which==33||b.which==34||b.which==35||b.which==36||b.which==37||b.which==38||b.which==39||b.which==40||b.which==45||b.which==46){d.items().length>0&&!d.isShow()&&b.which!=27&&(d.isShow(!0),d.refreshPanel());switch(b.which){case 13:d.currentIndex()>=0&&d.selectItem(d.items()[d.currentIndex()],b);break;case 40:d.currentIndex()<d.items().length-1?d.currentIndex(d.currentIndex()+1):d.currentIndex(-1);break;case 38:d.currentIndex()>0?d.currentIndex(d.currentIndex()-1):d.currentIndex()==-1?d.currentIndex(d.items().length-1):d.currentIndex(-1);break;case 27:d.currentIndex(-1),d.isShow(!1)}for(var c=0;c<d.items().length;c++)c==d.currentIndex()?d.items()[c].selected(!0):d.items()[c].selected(!1);return d.currentTerm()==d.inputElement.val()||d.currentIndex()>=0&&d.items()[d.currentIndex()].name==d.inputElement.val()?!0:(d.loadSource(d.inputElement.val().trim()),!0)}return d.loadSource(d.inputElement.val().trim()),!0},d.currentTerm=ko.observable(""),d.caches={},d.loadSource=function(a){if(a==d.currentTerm()||a.length<d.options.minLength)return a.length<d.options.minLength&&d.isShow(!1),!0;d.lastLoadTimer&&clearTimeout(d.lastLoadTimer),d.inputElement.data("keyword",d.inputElement.val()),d.currentIndex(-1),d.lastLoadTimer=setTimeout(function(){var b=d.caches[a];if(!b){var c={term:a};if(typeof d.options.source=="function")d.currentTerm(a),d.options.source(c,d.processResult);else if(typeof d.options.source=="string"||typeof d.options.source=="undefined"){var e=d.options.source||d.inputElement.data("autocomplete-url");if(!e)return;d.lastAjax&&(d.lastAjax.abort(),d.lastAjax=null),d.lastAjax=$.get(e,c,function(b){d.currentTerm(a),d.caches[a]=b,d.processResult(b)})}else d.currentTerm(a),d.processResult(d.options.source)}else d.currentTerm(a),d.processResult(b)},d.options.delay)},d.processResult=function(a){d.items.removeAll();if(a.length==0){d.isShow(!1);return}var b={};for(var c=0;c<a.length;c++){var e=a[c];b[e.category]||(b[e.category]={name:e.category,items:[]}),b[e.category].items.push(e)}for(var f in b)for(var c=0;c<b[f].items.length;c++)d.items.push({name:b[f].items[c].name,status:b[f].items[c].status,city:b[f].items[c].city,address:b[f].items[c].address,img:b[f].items[c].img,link:b[f].items[c].link,category:b[f].items[c].category,categoryIcon:b[f].items[c].categoryIcon,categoryLink:b[f].items[c].categoryLink,type:b[f].items[c].type,selected:ko.observable(!1),hasMoreItem:b[f].items[c].hasMoreItem})},d.showElement=function(a){a.nodeType===1&&$(a).hide().slideDown()},d.hideElement=function(a){a.nodeType===1&&$(a).slideUp(function(){$(a).remove()})},$(window).scroll(function(){d.refreshPanel()})}function DefaultKeyword(a,b,c){var d=this;d.id=a,d.name=b,this.items=ko.observableArray([]),d.index=c,d.hasLoadItem=!1,d.currentIndex=ko.observable(-1),d.loadData=function(a){d.hasLoadItem?typeof a=="function"&&a(d):$.getJSON("/directory/restaurantsbydefaultkeyword",{keywordId:this.id},function(b){if(b.length>0){for(var c=0;c<b.length;c++)b[c].index=c,d.items.push(b[c]);d.currentIndex(0)}typeof a=="function"&&a(d),d.hasLoadItem=!0})},d.handleItemHover=function(a,b){d.currentIndex(a.index)}}function DefaultKeywordModel(a,b){var c=this;c.panel=b.panel||$("#defaultkeyword"),c.options=b,c.items=ko.observableArray([]),c.currentIndex=ko.observable(-1),c.isShow=ko.observable(!1),c.input=$(a),c.isActive=ko.observable(!0),c.input.focus(function(a){c.input.val().length>0?c.isShow(!1):c.items().length>0?c.isShow(!0):c.loadData(function(){c.items().length>0&&c.isShow(!0)})}).keyup(function(a){if(c.input.val().length>0)return c.isShow(!1),!0;if(event.which==8||event.which==9||event.which==13||event.which==16||event.which==17||event.which==18||event.which==19||event.which==20||event.which==27||event.which==33||event.which==34||event.which==35||event.which==36||event.which==37||event.which==38||event.which==39||event.which==40||event.which==45||event.which==46){switch(event.which){case 40:if(c.isActive())c.currentIndex()<c.items().length-1?c.currentIndex(c.currentIndex()+1):c.currentIndex(-1);else if(c.currentIndex()>=0){var b=c.items()[c.currentIndex()];b.currentIndex()<b.items().length-1?b.currentIndex(b.currentIndex()+1):b.currentIndex(-1)}break;case 38:if(c.isActive())c.currentIndex()>0?c.currentIndex(c.currentIndex()-1):c.currentIndex()==-1?c.currentIndex(c.items().length-1):c.currentIndex(-1);else if(c.currentIndex()>=0){var b=c.items()[c.currentIndex()];b.currentIndex()>0?b.currentIndex(b.currentIndex()-1):b.currentIndex()==-1?b.currentIndex(b.items().length-1):b.currentIndex(-1)}break;case 27:c.isActive()&&(c.currentIndex(-1),c.isShow(!1));break;case 37:c.isActive()||c.isActive(!0);break;case 39:c.isActive()&&c.isActive(!1)}c.currentIndex()>=0&&(c.selectedItem(c.items()[c.currentIndex()]),c.selectedItem().loadData())}}),c.selectedItem=ko.observable({id:-1,items:[]}),c.handleItemClick=function(a,b){c.currentIndex(a.index),c.selectedItem(a),a.loadData()},c.loadData=function(a){$.getJSON("/directory/defaultkeywords",{provinceId:provinceId},function(b){if(b.length>0){for(var d=0;d<b.length;d++)c.items.push(new DefaultKeyword(b[d].id,b[d].name,d));c.selectedItem(c.items()[0]),c.selectedItem().loadData(),c.currentIndex(0)}typeof a=="function"&&a()})};var d=c.input.offset(),e=d.left+(c.options.offsetLeft||0),f=d.top+c.input.height()+parseInt(c.input.css("padding-top"))+parseInt(c.input.css("padding-bottom"))+parseInt(c.input.css("border-top-width"))+parseInt(c.input.css("border-bottom-width")+1)+(c.options.offsetTop||0),g=c.input.width()+parseInt(c.input.css("padding-left"))+parseInt(c.input.css("padding-right"))+parseInt(c.input.css("border-left-width"))+parseInt(c.input.css("border-right-width"))+(c.options.offsetWidth||0);c.panel.width(g).offset({top:f,left:e})}(function(a){a.fn.foodyAutocomplete=function(b){var c=a('<div class="foo-au-suggest-panel" data-bind="fadeVisible:isShow()"><ul class="group" data-bind="foreach: categories()"><li><span data-bind="attr:{class: categoryIcon}"></span><a data-bind="attr:{href:categoryLink},text: name" class="foo-au-group-name"></a><a class="fod-au-viewmore" data-bind="text:$root.options.viewMoreLinkText(), attr:{href: categoryLink+\'?q=\'+$root.inputElement.val()}, visible: hasMoreItem()"/><ul class="foo-au-items" data-bind="template:{foreach: items}"><li data-bind="css:{\'foo-au-item-selected\':selected(), \'foo-au-item-keyword\': type!=\'restaurant\'}, event:{mouseover: $root.hoverItem, click:$root.selectItem}" class="foo-au-item"><a data-bind="text:$root.options.detailsLinkText(), visible: type==\'restaurant\', attr:{href: link||\'javascript:void(0)\'}" class="foo-au-item-details-link"></a><img data-bind="attr:{title:$root.options.detailsLinkText },visible: img!=\'\'&&$root.options.showImg(), attr:{src: img}" class="foo-au-item-img" /><span data-bind="text: name" class="foo-au-keyword-text"></span><span data-bind="visible:city, text: \' \' + city + \'\'" class="foo-au-item-city"></span><span class="res-closed" data-bind="visible: status==4, text: $root.options.closedLinkText"></span><br /><address data-bind="text: address, visible:$root.options.showAddress()" class="foo-au-item-address"></address></li></ul></li></ul></div>'),d=a('<div class="default-keyword" style="position: absolute" data-bind="visible: isShow"><ul data-bind="foreach: items" class="left"><li data-bind="text: name, css:{\'selected\':$root.currentIndex()==index}, click: $root.handleItemClick, event:{mouseover: $root.handleItemClick} "></li></ul><!--ko with: selectedItem()--><ul data-bind="foreach: items" class="right"><li data-bind="css:{\'selected\':$parent.currentIndex()==index}, event:{mouseover: $parent.handleItemHover}"><a data-bind="text: name, attr:{href: link}"></a></li></ul><!--/ko--></div>');this.options=b;var e={},f=this;this.each(function(g,h){var i=a(this),j=a(a(f.options.panel).html());if(!j||j.length==0)j=c.clone();j.appendTo("body"),i.data("index",g),i.data("fod-au","fod-au"+g),i.attr("autocomplete","off"),j.data("fod-au","fod-au"+g);var k=d.clone();k.data("fod-au","fod-au"+g),k.appendTo("body"),i.focus(function(){a(this).click()}).click(function(){var b=e["model"+a(this).data("index")],c=e["keywordModel"+a(this).data("index")];for(var d in e)e[d]!=b&&typeof e[d].isShow=="function"&&e[d].isShow(!1),e[d]!=c&&typeof e[d].isShow=="function"&&e[d].isShow(!1);b.items().length>0&&a(this).val().length>0&&(b.isShow(!0),b.refreshPanel()),c.items().length>0&&a(this).val().length==0?c.isShow(!0):c.isShow(!1)}).keyup(function(b){var c=e["model"+a(this).data("index")];c&&c.filterKeyword(this,b)}),a(document).click(function(b){var c=a(b.target),d=0,f=!0;while(c.length>0&&d++<10){if(c[0].tagName=="BODY")break;if(c.data("fod-au")){f=!1;break}c=c.parent()}if(f){var g=e["model"+a(i).data("index")];g&&(g.isShow(!1),g.refreshPanel());var h=e["keywordModel"+a(i).data("index")];h&&h.isShow(!1)}});var l=new AutoCompleteMode(i,j,b);e["model"+g]=l,i.data("model",l),ko.applyBindings(l,j[0]);if(b.showDefaultKeywords){var m=new DefaultKeywordModel(i,{panel:k});ko.applyBindings(m,k[0]),e["keywordModel"+g]=m,i.data("keywordModel",m)}})}})(jQuery),ko.bindingHandlers.fadeVisible={init:function(a,b){var c=b();$(a).toggle(ko.utils.unwrapObservable(c))},update:function(a,b){var c=b();ko.utils.unwrapObservable(c)?$(a).fadeIn(200):$(a).fadeOut(100)}}
  25. ;function checkHideOrShowFeeds(){$("#feedsFlyout").hover(function(){feed_mouse_is_inside=!0},function(){feed_mouse_is_inside=!1}),$("#feedbtn").hover(function(){feed_mouse_is_inside=!0},function(){feed_mouse_is_inside=!1}),$("body").mouseup(function(){feed_mouse_is_inside||($("#feedsFlyout").hide(),$(".feedBox span.arrow").hide())})}var FeedsModel=function(a){var b=this;b.newestId=ko.observable(a.NewestId),b.feeds=ko.observableArray(a.Feeds),b.lastId=ko.observable(a.LastId),b.total=ko.observable(a.Total),b.currentTimestamp=a.CurrentTimeStamp,b.isLoadingMore=ko.observable(!1),b.pageSize=ko.observable(a.PageSize),b.loadMore=function(){if(b.total()-b.pageSize()>0){b.isLoadingMore(!0);var a=new Date;$.get("/feed/feeds?lastId="+b.lastId()+"&t="+a.getTime(),function(a){if(a.success){for(var c=0;c<a.data.Feeds.length;c++)b.feeds.push(a.data.Feeds[c]);b.total(a.data.Total),b.lastId(a.data.LastId),b.calculateFeedPostedTime()}b.isLoadingMore(!1)})}},b.getDiffTime=function(a){var b="";return a<60?b=CommonText.PostedTime_AFewSecondsAgo:a<120?b=CommonText.PostedTime_About1MinuteAgo:a<3600?b=Math.floor(a/60)+" "+CommonText.PostedTime_MinutesAgo:a<7200?b=CommonText.PostedTime_About1HourAgo:a<86400&&(b=Math.floor(a/3600)+" "+CommonText.PostedTime_HoursAgo),b},b.setUpdatedTime=function(a){setInterval(function(){b.currentTimestamp+=a/1e3,b.calculateFeedPostedTime()},a)},b.calculateFeedPostedTime=function(){var a=parseInt(b.currentTimestamp);$(".feed-posted-time").each(function(c,d){var e=parseInt($(this).attr("utime")),f=b.getDiffTime(a-e);f==0||f==""?$(this).text($(this).attr("title")):($(this).text(f),$(this).fadeIn())})},b.getDetailLink=function(a){var b="";switch(a.Type){case 1:break;case 2:b="/thanh-vien/"+a.FounderUserName;break;case 3:case 4:case 5:b=a.Url;break;case 7:b="http://www.foody.vn";break;case 8:b=a.ResUrl+"/album-anh-"+a.GroupId;break;case 9:case 10:b=a.Url;break;case 6:case 11:b=a.ResUrl;break;case 12:case 13:case 14:case 17:case 18:case 19:b=a.Url}return b}},isviewingfeeds=!1,feedsModel=null;$("#feedbtn").live("click",function(){if(!$("#feedsFlyout").is(":visible")){var a=new Date;isviewingfeeds=!0,$("#feedsFlyout").show(),$(".feedBox span.arrow").show(),feedsModel==null?($("#feed-loading").show(),$(".feed-content").hide(),$.get("/feed/feeds?t="+a.getTime(),function(a){a.success&&(feedsModel=new FeedsModel(a.data),ko.applyBindings(feedsModel,document.getElementById("feedsFlyout")),$("#feed-loading").hide(),$("#feed-box").show(),$(".feed-content").show(),feedsModel.calculateFeedPostedTime(),feedsModel.setUpdatedTime(5e3))})):($("#feed-loading").show(),a=new Date,$.get("/feed/feeds?newestId="+feedsModel.newestId()+"&t="+a.getTime(),function(a){if(a.success){if(a.data.Feeds.length>0){for(var b=a.data.Feeds.length-1;b>=0;b--)feedsModel.feeds.unshift(a.data.Feeds[b]);feedsModel.newestId(a.data.NewestId),feedsModel.calculateFeedPostedTime(),$("#feeds-box-container").scrollTop(0)}$("#feed-loading").hide()}}))}else $("#feedsFlyout").hide(),$(".feedBox span.arrow").hide(),isviewingfeeds=!1});var feed_mouse_is_inside=!1;$(function(){$("#feeds-box-container").scroll(function(){$("#feeds-box-container")[0].scrollHeight*1/4<$("#feeds-box-container").scrollTop()&&(feedsModel.isLoadingMore()||feedsModel.loadMore())})}),FeedsModel.Init=function(){checkHideOrShowFeeds()}
  26. ;function checkPopupFirstName(a){return!a||a.length==0||$.trim(a)==""?(updatePopupValid("firstName",!1,ErrorText.Mem_Err1),!1):$.trim(a).length<2?(updatePopupValid("firstName",!1,ErrorText.Mem_Err2),!1):/^([a-zA-Z ]|[\u00C0-\u1EF9])+([\w\d-_]|[\u00C0-\u1EF9]|[\s]+)*$/.test(a)?(updatePopupValid("firstName",!0,ErrorText.Mem_Err4),!0):(updatePopupValid("firstName",!1,ErrorText.Mem_Err3),!1)}function checkPopupLastName(a){return!a||a.length==0||$.trim(a)==""?(updatePopupValid("lastName",!1,ErrorText.Mem_Err5),!1):$.trim(a).length<2?(updatePopupValid("lastName",!1,ErrorText.Mem_Err6),!1):/^([a-zA-Z ]|[\u00C0-\u1EF9])+([\w\d-_]|[\u00C0-\u1EF9]|[\s]+)*$/.test(a)?(updatePopupValid("lastName",!0,ErrorText.Mem_Err8),!0):(updatePopupValid("lastName",!1,ErrorText.Mem_Err7),!1)}function checkPopupPassword(a){return!a||a.length==0?(updatePopupValid("password",!1,ErrorText.Mem_Err9),!1):a.length<4||a.length>20?(updatePopupValid("password",!1,ErrorText.Mem_Err10),!1):(updatePopupValid("password",!0,ErrorText.Mem_Err11),checkPopupConfirmPassword($("#ConfirmPassword").val(),$("#Password").val()),!0)}function checkPopupConfirmPassword(a,b){return!a||a.length==0?(updatePopupValid("confirmPassword",!1,ErrorText.Mem_Err12),!1):a!==b?(updatePopupValid("confirmPassword",!1,ErrorText.Mem_Err13),!1):(updatePopupValid("confirmPassword",!0,ErrorText.Mem_Err14),!0)}function checkTermAndCondition(){return $("#Reg_TermAndCondition").is(":checked")?!0:!1}function checkPopupEmail(a){isValidMail=!0;if(!a||a.length==0||$.trim(a)=="")return updatePopupValid("email",!1,ErrorText.Mem_Err15),isValidMail=!1,!1;var b=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return b.test(a)?(showWaiting("email"),$.post("/Account/IsValidField",{fieldType:"email",fieldName:"Email",fieldValue:a},function(a){hideWaiting("email"),updatePopupValid("email",a.isValid,a.message),isValidMail=a.isValid}),isValidMail):(updatePopupValid("email",!1,ErrorText.Mem_Err16),isValidMail=!1,!1)}function hideWaiting(){}function showWaiting(a){}function updatePopupValid(a,b,c){var d=staticPath+"style/images/icons/correct-icon.png",e=staticPath+"style/images/icons/uncorrect-icon.png",f="";switch(a){case"email":f="emailPopupValid";break;case"firstName":f="firstNamePopupValid";break;case"lastName":f="lastNamePopupValid";break;case"password":f="passwordPopupValid";break;case"confirmPassword":f="confirmPasswordPopupValid"}var g=$("#"+f+" img");g.attr("original-title",c),b?g.attr("src",d):g.attr("src",e),g.fadeIn()}var LoginPopup=function(){},justRegister=!1;LoginPopup.RequiredLogin=function(a,b){var c=new Date;$.ajax({type:"GET",url:"/Review/IsLogin?"+c.getTime(),success:function(c){c.success==1?a():LoginPopup.Show(function(){$.modal.close(),a()},b)}})},LoginPopup.ShowFacebookRecommendedLogin=function(a,b){$.modal.close(),$("#loginFacebookPopup").modal({persist:!0,onClose:function(a){$.modal.close(),typeof b!="undefined"&&b!=null&&b()}}),$("#simplemodal-container").css("height","400px");var c=new Date;$.get("/account/GetFacebookRecommendLogin?t="+c.getTime(),function(a){a.success&&($("#loginFacebookPopup").html(a.html),FB.XFBML.parse($("#loginFacebookPopup")[0]))}),$(window).resize(),typeof a!="undefined"&&a!=null&&(loginSuccessCallback=a)},LoginPopup.Show=function(a,b){$.modal.close(),$("#popup-login-div").show(),$("#popup-register-div").hide(),registerPopupModel.reset(),$("#loginPopup").modal({persist:!0,onClose:function(a){$.modal.close(),typeof b!="undefined"&&b!=null&&b()}}),$("#simplemodal-container").css("height","280px"),$(window).resize(),typeof a!="undefined"&&a!=null&&(loginSuccessCallback=a)};var validImgs=new Array("emailPopupValid","firstNamePopupValid","lastNamePopupValid","passwordPopupValid","confirmPasswordPopupValid"),RegisterPopupModel=function(){var a=this;a.FirstName=ko.observable(""),a.LastName=ko.observable(""),a.Email=ko.observable(""),a.Password=ko.observable(""),a.ConfirmPassword=ko.observable(""),a.TermAndCondition=ko.observable(!0),a.IsRegistering=ko.observable(!1),a.IsSuccess=ko.observable(!1),a.IsFail=ko.observable(!1),a.checkFirstName=ko.computed(function(){return checkPopupFirstName(a.FirstName())}),a.checkLastName=ko.computed(function(){return checkPopupLastName(a.LastName())}),a.checkEmail=ko.computed(function(){return checkPopupEmail(a.Email())}),a.checkPassword=ko.computed(function(){var b=checkPopupPassword(a.Password());return b=b&&checkPopupConfirmPassword(a.ConfirmPassword(),a.Password()),b}),a.checkConfirmPassword=ko.computed(function(){return checkPopupConfirmPassword(a.ConfirmPassword(),a.Password())}),a.checkTermAndCondition=ko.computed(function(){return a.TermAndCondition()}),a.register=function(){if(!a.checkTermAndCondition()){alert(ErrorText.Mem_Err17);return}checkPopupFirstName(a.FirstName()),checkPopupLastName(a.LastName()),checkPopupEmail(a.Email()),checkPopupPassword(a.Password()),checkPopupConfirmPassword(a.ConfirmPassword(),a.Password()),!a.IsRegistering()&&a.checkFirstName()&&a.checkLastName()&&a.checkEmail()&&a.checkConfirmPassword()&&a.checkPassword()&&(a.IsRegistering(!0),$.ajax({type:"POST",url:"/Account/RegisterAjax",data:ko.mapping.toJSON(a),success:function(b){b.success?(justRegister=!0,a.IsSuccess(!0),login(a.Email(),a.Password(),!0,commonLoginCallback)):a.IsFail(!0),a.IsRegistering(!1)},dataType:"json",contentType:"application/json"}))},a.reset=function(){a.FirstName(""),a.LastName(""),a.Email(""),a.Password(""),a.ConfirmPassword("");for(var b=0;b<validImgs.length;b++){var c=$("#"+validImgs[b]+" img");c.css("display","none"),c.attr("original-title",""),c.attr("src","")}LoginPopup.BindingsWatermark()}},registerPopupModel=null;$(function(){$("img.registerStatus").tipsy({gravity:"w"}),$("#bt-register").click(function(){$("#popup-login-div").hide(),$("#popup-register-div").show(),$("#simplemodal-container").css("height","422px"),$(window).resize()}),$("#popup-register-div #bt-cancel").click(function(){$("#popup-login-div").show(),$("#popup-register-div").hide(),$("#simplemodal-container").css("height","280px"),$(window).resize()});var a=$("#popup-register-div");a.length>0&&(registerPopupModel=new RegisterPopupModel,ko.applyBindings(registerPopupModel,document.getElementById("popup-register-div")))});var isValidMail=!0;$("#registerForm").submit(function(a){var b=checkPopupFirstName($("#Reg_FirstName").val()),c=checkPopupLastName($("#Reg_LastName").val()),d=checkPopupEmail($("#Reg_Email").val()),e=checkPopupPassword($("#Reg_Password").val()),f=checkPopupConfirmPassword($("#Reg_Password").val(),$("#Reg_ConfirmPassword").val());return b&&c&&isValidMail&&e&&f?checkTermAndCondition()?!0:(alert(ErrorText.Mem_Err17),!1):!1})
  27. ;(function(a){a.fn.tipsy=function(b){return b=a.extend({},a.fn.tipsy.defaults,b),this.each(function(){var c=a.fn.tipsy.elementOptions(this,b);a(this).hover(function(){a.data(this,"cancel.tipsy",!0);var b=a.data(this,"active.tipsy");b||(b=a('<div class="tipsy"><div class="tipsy-inner"/></div>'),b.css({position:"absolute",zIndex:1e5}),a.data(this,"active.tipsy",b)),(a(this).attr("title")||typeof a(this).attr("original-title")!="string")&&a(this).attr("original-title",a(this).attr("title")||"").removeAttr("title");var d;typeof c.title=="string"?d=a(this).attr(c.title=="title"?"original-title":c.title):typeof c.title=="function"&&(d=c.title.call(this)),b.find(".tipsy-inner")[c.html?"html":"text"](d||c.fallback);var e=a.extend({},a(this).offset(),{width:this.offsetWidth,height:this.offsetHeight});b.get(0).className="tipsy",b.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);var f=b[0].offsetWidth,g=b[0].offsetHeight,h=typeof c.gravity=="function"?c.gravity.call(this):c.gravity;switch(h.charAt(0)){case"n":b.css({top:e.top+e.height,left:e.left+e.width/2-f/2}).addClass("tipsy-north");break;case"s":b.css({top:e.top-g,left:e.left+e.width/2-f/2}).addClass("tipsy-south");break;case"e":b.css({top:e.top+e.height/2-g/2,left:e.left-f}).addClass("tipsy-east");break;case"w":b.css({top:e.top+e.height/2-g/2,left:e.left+e.width}).addClass("tipsy-west")}c.fade?b.css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:.8}):b.css({visibility:"visible"})},function(){a.data(this,"cancel.tipsy",!1);var b=this;setTimeout(function(){if(a.data(this,"cancel.tipsy"))return;var d=a.data(b,"active.tipsy");c.fade?d.stop().fadeOut(function(){a(this).remove()}):d.remove()},100)})})},a.fn.tipsy.elementOptions=function(b,c){return a.metadata?a.extend({},c,a(b).metadata()):c},a.fn.tipsy.defaults={fade:!1,fallback:"",gravity:"n",html:!1,title:"title"},a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"},a.fn.tipsy.autoWE=function(){return a(this).offset().left>a(document).scrollLeft()+a(window).width()/2?"e":"w"}})(jQuery)
  28. ;/*!
  29.  * jQuery Tools v1.2.7 - The missing UI library for the Web
  30.  *
  31.  * overlay/overlay.js
  32.  * overlay/overlay.apple.js
  33.  * scrollable/scrollable.js
  34.  * scrollable/scrollable.autoscroll.js
  35.  * scrollable/scrollable.navigator.js
  36.  * tabs/tabs.js
  37.  * tooltip/tooltip.js
  38.  * tooltip/tooltip.dynamic.js
  39.  * tooltip/tooltip.slide.js
  40.  *
  41.  * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
  42.  *
  43.  * http://flowplayer.org/tools/
  44.  *
  45.  */
  46. (function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.overlay={addEffect:function(a,b,d){c[a]=[b,d]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var b=[],c={};a.tools.overlay.addEffect("default",function(b,c){var d=this.getConf(),e=a(window);d.fixed||(b.top+=e.scrollTop(),b.left+=e.scrollLeft()),b.position=d.fixed?"fixed":"absolute",this.getOverlay().css(b).fadeIn(d.speed,c)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,a)});function d(d,e){var f=this,g=d.add(f),h=a(window),i,j,k,l=a.tools.expose&&(e.mask||e.expose),m=Math.random().toString().slice(10);l&&(typeof l=="string"&&(l={color:l}),l.closeOnClick=l.closeOnEsc=!1);var n=e.target||d.attr("rel");j=n?a(n):null||d;if(!j.length)throw"Could not find Overlay: "+n;d&&d.index(j)==-1&&d.click(function(a){f.load(a);return a.preventDefault()}),a.extend(f,{load:function(d){if(f.isOpened())return f;var i=c[e.effect];if(!i)throw"Overlay: cannot find effect : \""+e.effect+"\"";e.oneInstance&&a.each(b,function(){this.close(d)}),d=d||a.Event(),d.type="onBeforeLoad",g.trigger(d);if(d.isDefaultPrevented())return f;k=!0,l&&a(j).expose(l);var n=e.top,o=e.left,p=j.outerWidth({margin:!0}),q=j.outerHeight({margin:!0});typeof n=="string"&&(n=n=="center"?Math.max((h.height()-q)/2,0):parseInt(n,10)/100*h.height()),o=="center"&&(o=Math.max((h.width()-p)/2,0)),i[0].call(f,{top:n,left:o},function(){k&&(d.type="onLoad",g.trigger(d))}),l&&e.closeOnClick&&a.mask.getMask().one("click",f.close),e.closeOnClick&&a(document).on("click."+m,function(b){a(b.target).parents(j).length||f.close(b)}),e.closeOnEsc&&a(document).on("keydown."+m,function(a){a.keyCode==27&&f.close(a)});return f},close:function(b){if(!f.isOpened())return f;b=b||a.Event(),b.type="onBeforeClose",g.trigger(b);if(!b.isDefaultPrevented()){k=!1,c[e.effect][1].call(f,function(){b.type="onClose",g.trigger(b)}),a(document).off("click."+m+" keydown."+m),l&&a.mask.close();return f}},getOverlay:function(){return j},getTrigger:function(){return d},getClosers:function(){return i},isOpened:function(){return k},getConf:function(){return e}}),a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),i=j.find(e.close||".close"),!i.length&&!e.close&&(i=a("<a class=\"close\"></a>"),j.prepend(i)),i.click(function(a){f.close(a)}),e.load&&f.load()}a.fn.overlay=function(c){var e=this.data("overlay");if(e)return e;a.isFunction(c)&&(c={onBeforeLoad:c}),c=a.extend(!0,{},a.tools.overlay.conf,c),this.each(function(){e=new d(a(this),c),b.push(e),a(this).data("overlay",e)});return c.api?e:this}})(jQuery);
  47. (function(a){var b=a.tools.overlay,c=a(window);a.extend(b.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function d(a){var b=a.offset();return{top:b.top+a.height()/2,left:b.left+a.width()/2}}var e=function(b,e){var f=this.getOverlay(),g=this.getConf(),h=this.getTrigger(),i=this,j=f.outerWidth({margin:!0}),k=f.data("img"),l=g.fixed?"fixed":"absolute";if(!k){var m=f.css("backgroundImage");if(!m)throw"background-image CSS property not set for overlay";m=m.slice(m.indexOf("(")+1,m.indexOf(")")).replace(/\"/g,""),f.css("backgroundImage","none"),k=a("<img src=\""+m+"\"/>"),k.css({border:0,display:"none"}).width(j),a("body").append(k),f.data("img",k)}var n=g.start.top||Math.round(c.height()/2),o=g.start.left||Math.round(c.width()/2);if(h){var p=d(h);n=p.top,o=p.left}g.fixed?(n-=c.scrollTop(),o-=c.scrollLeft()):(b.top+=c.scrollTop(),b.left+=c.scrollLeft()),k.css({position:"absolute",top:n,left:o,width:0,zIndex:g.zIndex}).show(),b.position=l,f.css(b),k.animate({top:b.top,left:b.left,width:j},g.speed,function(){f.css("zIndex",g.zIndex+1).fadeIn(g.fadeInSpeed,function(){i.isOpened()&&!a(this).index(f)?e.call():f.hide()})}).css("position",l)},f=function(b){var e=this.getOverlay().hide(),f=this.getConf(),g=this.getTrigger(),h=e.data("img"),i={top:f.start.top,left:f.start.left,width:0};g&&a.extend(i,d(g)),f.fixed&&h.css({position:"absolute"}).animate({top:"+="+c.scrollTop(),left:"+="+c.scrollLeft()},0),h.animate(i,f.closeSpeed,b)};b.addEffect("apple",e,f)})(jQuery);
  48. (function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,wheelSpeed:0}};function b(a,b){var c=parseInt(a.css(b),10);if(c)return c;var d=a[0].currentStyle;return d&&d.width&&parseInt(d.width,10)}function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}var d;function e(b,e){var f=this,g=b.add(f),h=b.children(),i=0,j=e.vertical;d||(d=f),h.length>1&&(h=a(e.items,b)),e.size>1&&(e.circular=!1),a.extend(f,{getConf:function(){return e},getIndex:function(){return i},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return n.add(o)},getRoot:function(){return b},getItemWrap:function(){return h},getItems:function(){return h.find(e.item).not("."+e.clonedClass)},move:function(a,b){return f.seekTo(i+a,b)},next:function(a){return f.move(e.size,a)},prev:function(a){return f.move(-e.size,a)},begin:function(a){return f.seekTo(0,a)},end:function(a){return f.seekTo(f.getSize()-1,a)},focus:function(){d=f;return f},addItem:function(b){b=a(b),e.circular?(h.children().last().before(b),h.children().first().replaceWith(b.clone().addClass(e.clonedClass))):(h.append(b),o.removeClass("disabled")),g.trigger("onAddItem",[b]);return f},seekTo:function(b,c,k){b.jquery||(b*=1);if(e.circular&&b===0&&i==-1&&c!==0)return f;if(!e.circular&&b<0||b>f.getSize()||b<-1)return f;var l=b;b.jquery?b=f.getItems().index(b):l=f.getItems().eq(b);var m=a.Event("onBeforeSeek");if(!k){g.trigger(m,[b,c]);if(m.isDefaultPrevented()||!l.length)return f}var n=j?{top:-l.position().top}:{left:-l.position().left};i=b,d=f,c===undefined&&(c=e.speed),h.animate(n,c,e.easing,k||function(){g.trigger("onSeek",[b])});return f}}),a.each(["onBeforeSeek","onSeek","onAddItem"],function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}});if(e.circular){var k=f.getItems().slice(-1).clone().prependTo(h),l=f.getItems().eq(1).clone().appendTo(h);k.add(l).addClass(e.clonedClass),f.onBeforeSeek(function(a,b,c){if(!a.isDefaultPrevented()){if(b==-1){f.seekTo(k,c,function(){f.end(0)});return a.preventDefault()}b==f.getSize()&&f.seekTo(l,c,function(){f.begin(0)})}});var m=b.parents().add(b).filter(function(){if(a(this).css("display")==="none")return!0});m.length?(m.show(),f.seekTo(0,0,function(){}),m.hide()):f.seekTo(0,0,function(){})}var n=c(b,e.prev).click(function(a){a.stopPropagation(),f.prev()}),o=c(b,e.next).click(function(a){a.stopPropagation(),f.next()});e.circular||(f.onBeforeSeek(function(a,b){setTimeout(function(){a.isDefaultPrevented()||(n.toggleClass(e.disabledClass,b<=0),o.toggleClass(e.disabledClass,b>=f.getSize()-1))},1)}),e.initialIndex||n.addClass(e.disabledClass)),f.getSize()<2&&n.add(o).addClass(e.disabledClass),e.mousewheel&&a.fn.mousewheel&&b.mousewheel(function(a,b){if(e.mousewheel){f.move(b<0?1:-1,e.wheelSpeed||50);return!1}});if(e.touch){var p={};h[0].ontouchstart=function(a){var b=a.touches[0];p.x=b.clientX,p.y=b.clientY},h[0].ontouchmove=function(a){if(a.touches.length==1&&!h.is(":animated")){var b=a.touches[0],c=p.x-b.clientX,d=p.y-b.clientY;f[j&&d>0||!j&&c>0?"next":"prev"](),a.preventDefault()}}}e.keyboard&&a(document).on("keydown.scrollable",function(b){if(!(!e.keyboard||b.altKey||b.ctrlKey||b.metaKey||a(b.target).is(":input"))){if(e.keyboard!="static"&&d!=f)return;var c=b.keyCode;if(j&&(c==38||c==40)){f.move(c==38?-1:1);return b.preventDefault()}if(!j&&(c==37||c==39)){f.move(c==37?-1:1);return b.preventDefault()}}}),e.initialIndex&&f.seekTo(e.initialIndex,0,function(){})}a.fn.scrollable=function(b){var c=this.data("scrollable");if(c)return c;b=a.extend({},a.tools.scrollable.conf,b),this.each(function(){c=new e(a(this),b),a(this).data("scrollable",c)});return b.api?c:this}})(jQuery);
  49. (function(a){var b=a.tools.scrollable;b.autoscroll={conf:{autoplay:!0,interval:3e3,autopause:!0}},a.fn.autoscroll=function(c){typeof c=="number"&&(c={interval:c});var d=a.extend({},b.autoscroll.conf,c),e;this.each(function(){var b=a(this).data("scrollable"),c=b.getRoot(),f,g=!1;function h(){f&&clearTimeout(f),f=setTimeout(function(){b.next()},d.interval)}b&&(e=b),b.play=function(){f||(g=!1,c.on("onSeek",h),h())},b.pause=function(){f=clearTimeout(f),c.off("onSeek",h)},b.resume=function(){g||b.play()},b.stop=function(){g=!0,b.pause()},d.autopause&&c.add(b.getNaviButtons()).hover(b.pause,b.resume),d.autoplay&&b.play()});return d.api?e:this}})(jQuery);
  50. (function(a){var b=a.tools.scrollable;b.navigator={conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:!1,idPrefix:null,history:!1}};function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}a.fn.navigator=function(d){typeof d=="string"&&(d={navi:d}),d=a.extend({},b.navigator.conf,d);var e;this.each(function(){var b=a(this).data("scrollable"),f=d.navi.jquery?d.navi:c(b.getRoot(),d.navi),g=b.getNaviButtons(),h=d.activeClass,i=d.history&&history.pushState,j=b.getConf().size;b&&(e=b),b.getNaviButtons=function(){return g.add(f)},i&&(history.pushState({i:0},""),a(window).on("popstate",function(a){var c=a.originalEvent.state;c&&b.seekTo(c.i)}));function k(a,c,d){b.seekTo(c),d.preventDefault(),i&&history.pushState({i:c},"")}function l(){return f.find(d.naviItem||"> *")}function m(b){var c=a("<"+(d.naviItem||"a")+"/>").click(function(c){k(a(this),b,c)});b===0&&c.addClass(h),d.indexed&&c.text(b+1),d.idPrefix&&c.attr("id",d.idPrefix+b);return c.appendTo(f)}l().length?l().each(function(b){a(this).click(function(c){k(a(this),b,c)})}):a.each(b.getItems(),function(a){a%j==0&&m(a)}),b.onBeforeSeek(function(a,b){setTimeout(function(){if(!a.isDefaultPrevented()){var c=b/j,d=l().eq(c);d.length&&l().removeClass(h).eq(c).addClass(h)}},1)}),b.onAddItem(function(a,c){var d=b.getItems().index(c);d%j==0&&m(d)})});return d.api?e:this}})(jQuery);
  51. (function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialEffect:!1,initialIndex:0,event:"click",rotate:!1,slideUpSpeed:400,slideDownSpeed:400,history:!1},addEffect:function(a,c){b[a]=c}};var b={"default":function(a,b){this.getPanes().hide().eq(a).show(),b.call()},fade:function(a,b){var c=this.getConf(),d=c.fadeOutSpeed,e=this.getPanes();d?e.fadeOut(d):e.hide(),e.eq(a).fadeIn(c.fadeInSpeed,b)},slide:function(a,b){var c=this.getConf();this.getPanes().slideUp(c.slideUpSpeed),this.getPanes().eq(a).slideDown(c.slideDownSpeed,b)},ajax:function(a,b){this.getPanes().eq(0).load(this.getTabs().eq(a).attr("href"),b)}},c,d;a.tools.tabs.addEffect("horizontal",function(b,e){if(!c){var f=this.getPanes().eq(b),g=this.getCurrentPane();d||(d=this.getPanes().eq(0).width()),c=!0,f.show(),g.animate({width:0},{step:function(a){f.css("width",d-a)},complete:function(){a(this).hide(),e.call(),c=!1}}),g.length||(e.call(),c=!1)}});function e(c,d,e){var f=this,g=c.add(this),h=c.find(e.tabs),i=d.jquery?d:c.children(d),j;h.length||(h=c.children()),i.length||(i=c.parent().find(d)),i.length||(i=a(d)),a.extend(this,{click:function(d,i){var k=h.eq(d),l=!c.data("tabs");typeof d=="string"&&d.replace("#","")&&(k=h.filter("[href*=\""+d.replace("#","")+"\"]"),d=Math.max(h.index(k),0));if(e.rotate){var m=h.length-1;if(d<0)return f.click(m,i);if(d>m)return f.click(0,i)}if(!k.length){if(j>=0)return f;d=e.initialIndex,k=h.eq(d)}if(d===j)return f;i=i||a.Event(),i.type="onBeforeClick",g.trigger(i,[d]);if(!i.isDefaultPrevented()){var n=l?e.initialEffect&&e.effect||"default":e.effect;b[n].call(f,d,function(){j=d,i.type="onClick",g.trigger(i,[d])}),h.removeClass(e.current),k.addClass(e.current);return f}},getConf:function(){return e},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return f.click(j+1)},prev:function(){return f.click(j-1)},destroy:function(){h.off(e.event).removeClass(e.current),i.find("a[href^=\"#\"]").off("click.T");return f}}),a.each("onBeforeClick,onClick".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),e.history&&a.fn.history&&(a.tools.history.init(h),e.event="history"),h.each(function(b){a(this).on(e.event,function(a){f.click(b,a);return a.preventDefault()})}),i.find("a[href^=\"#\"]").on("click.T",function(b){f.click(a(this).attr("href"),b)}),location.hash&&e.tabs=="a"&&c.find("[href=\""+location.hash+"\"]").length?f.click(location.hash):(e.initialIndex===0||e.initialIndex>0)&&f.click(e.initialIndex)}a.fn.tabs=function(b,c){var d=this.data("tabs");d&&(d.destroy(),this.removeData("tabs")),a.isFunction(c)&&(c={onBeforeClick:c}),c=a.extend({},a.tools.tabs.conf,c),this.each(function(){d=new e(a(this),b,c),a(this).data("tabs",d)});return c.api?d:this}})(jQuery);
  52. (function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.on(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).on(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.off(p[0]).on(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);
  53. (function(a){var b=a.tools.tooltip;b.dynamic={conf:{classNames:"top right bottom left"}};function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){var b=a.length;while(b--)if(a[b])return!1;return!0}a.fn.dynamic=function(e){typeof e=="number"&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=a.extend(!0,{},e),g=e.classNames.split(/\s/),h;this.each(function(){var b=a(this).tooltip().onBeforeShow(function(b,e){var i=this.getTip(),j=this.getConf();h||(h=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,h[4]),j.position=[h[0],h[1]],j.offset=[h[2],h[3]],i.css({visibility:"hidden",position:"absolute",top:e.top,left:e.left}).show();var k=a.extend(!0,{},f),l=c(i);if(!d(l)){l[2]&&(a.extend(j,k.top),j.position[0]="top",i.addClass(g[0])),l[3]&&(a.extend(j,k.right),j.position[1]="right",i.addClass(g[1])),l[0]&&(a.extend(j,k.bottom),j.position[0]="bottom",i.addClass(g[2])),l[1]&&(a.extend(j,k.left),j.position[1]="left",i.addClass(g[3]));if(l[0]||l[2])j.offset[0]*=-1;if(l[1]||l[3])j.offset[1]*=-1}i.css({visibility:"visible"}).hide()});b.onBeforeShow(function(){var a=this.getConf(),b=this.getTip();setTimeout(function(){a.position=[h[0],h[1]],a.offset=[h[2],h[3]]},0)}),b.onHide(function(){var a=this.getTip();a.removeClass(e.classNames)}),ret=b});return e.api?ret:this}})(jQuery);
  54. (function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!a.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)},function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h=h=="+"?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,function(){a(this).hide(),b.call()})})})(jQuery);
  55.  
  56. ;(function(a){var b={onresize:function(){},buffer:1,minRows:4,animate:!0,animationDuration:50,limitHeight:!1,resizeOnStart:!1};a.fn.autoresize=function(c){return this.each(function(){var d=a.extend({},b,c||{}),e=a(this).css({"overflow-y":"hidden"}),f=function(){var b={position:"absolute",top:-9999,left:-9999};return a.each(["height","width","lineHeight","letterSpacing","fontFamily","fontSize","fontWeight"],function(a,c){b[c]=e.css(c)}),e.clone().css(b).removeAttr("id").removeAttr("name").attr("tabIndex","-1").appendTo(a("body"))}(),g=function(){var a=f.val(),b=13;f.val("");for(var c=0;c<10;c++){f.val(f.val()+"\n"),f.scrollTop(1e4);if(f.scrollTop()>0){b=f.scrollTop();break}}return f.val(a),b}(),h=null,i=function(){f.val(e.val()).scrollTop(1e4);var b=Math.max(f.height()+f.scrollTop()+d.buffer*g,d.minRows*g);d.limitHeight&&b>d.limitHeight&&(b=d.limitHeight),b!==h&&(e.scrollTop(0),d.animate?a(this).animate({height:b},d.animationDuration,function(){d.onresize.call(this)}):(e.height(b),d.onresize.call(this)),h=b)};e.unbind(".autoresize").bind("focus.autoresize",i).bind("change.autoresize",i).bind("keyup.autoresize",i).bind("keydown.autoresize",i),d.resizeOnStart&&e.keydown()})}})(jQuery)
  57. ;jQuery(function(a){a("a[data-filtermore]").click(function(b){return a(a(this).attr("data-filtermore")).modal({persist:!0}),!1})})
  58. ;(function(a){a.expander={version:"1.4.3",defaults:{slicePoint:100,preserveWords:!0,widow:4,expandText:"read more",expandPrefix:"&hellip; ",expandAfterSummary:!1,summaryClass:"summary",detailClass:"details",moreClass:"read-more",lessClass:"read-less",collapseTimer:0,expandEffect:"slideDown",expandSpeed:250,collapseEffect:"slideUp",collapseSpeed:200,userCollapse:!0,userCollapseText:"read less",userCollapsePrefix:" ",onSlice:null,beforeExpand:null,afterExpand:null,onCollapse:null}},a.fn.expander=function(b){function n(a,b){var c="span",d=a.summary;return b?(c="div",j.test(d)&&!a.expandAfterSummary?d=d.replace(j,a.moreLabel+"$1"):d+=a.moreLabel,d='<div class="'+a.summaryClass+'">'+d+"</div>"):d+=a.moreLabel,[d,"<",c+' class="'+a.detailClass+'"',">",a.details,"</"+c+">"].join("")}function o(a){var b='<span class="'+a.moreClass+'">'+a.expandPrefix;return b+='<a href="#">'+a.expandText+"</a></span>",b}function p(b,c){return b.lastIndexOf("<")>b.lastIndexOf(">")&&(b=b.slice(0,b.lastIndexOf("<"))),c&&(b=b.replace(f,"")),a.trim(b)}function q(a,b){b.stop(!0,!0)[a.collapseEffect](a.collapseSpeed,function(){var c=b.prev("span."+a.moreClass).show();c.length||b.parent().children("div."+a.summaryClass).show().find("span."+a.moreClass).show()})}function r(b,c,d){b.collapseTimer&&(l=setTimeout(function(){q(b,c),a.isFunction(b.onCollapse)&&b.onCollapse.call(d,!1)},b.collapseTimer))}var c="init";typeof b=="string"&&(c=b,b={});var d=a.extend({},a.expander.defaults,b),e=/^<(?:area|br|col|embed|hr|img|input|link|meta|param).*>$/i,f=d.wordEnd||/(&(?:[^;]+;)?|[a-zA-Z\u00C0-\u0100]+)$/,g=/<\/?(\w+)[^>]*>/g,h=/<(\w+)[^>]*>/g,i=/<\/(\w+)>/g,j=/(<\/[^>]+>)\s*$/,k=/^<[^>]+>.?/,l,m={init:function(){this.each(function(){function Q(a){a.preventDefault(),y.hide(),E.hide(),B.beforeExpand&&F.beforeExpand.call(C),x.stop(!1,!0)[F.expandEffect](L,function(){x.css({zoom:""}),B.afterExpand&&F.afterExpand.call(C),r(F,x,C)})}var b,c,f,j,m,s,t,u,v,w,x,y,z=[],A=[],B={},C=this,D=a(this),E=a([]),F=a.extend({},d,D.data("expander")||a.meta&&D.data()||{}),G=!!D.find("."+F.detailClass).length,H=!!D.find("*").filter(function(){var b=a(this).css("display");return/^block|table|list/.test(b)}).length,I=H?"div":"span",J=I+"."+F.detailClass,K="span."+F.moreClass,L=F.expandSpeed||0,M=a.trim(D.html()),N=a.trim(D.text()),O=M.slice(0,F.slicePoint);if(a.data(this,"expanderInit"))return;a.data(this,"expanderInit",!0),a.each(["onSlice","beforeExpand","afterExpand","onCollapse"],function(b,c){B[c]=a.isFunction(F[c])}),O=p(O),m=O.replace(g,"").length;while(m<F.slicePoint)j=M.charAt(O.length),j=="<"&&(j=M.slice(O.length).match(k)[0]),O+=j,m++;O=p(O,F.preserveWords),s=O.match(h)||[],t=O.match(i)||[],f=[],a.each(s,function(a,b){e.test(b)||f.push(b)}),s=f,c=t.length;for(b=0;b<c;b++)t[b]=t[b].replace(i,"$1");a.each(s,function(b,c){var d=c.replace(h,"$1"),e=a.inArray(d,t);e===-1?(z.push(c),A.push("</"+d+">")):t.splice(e,1)}),A.reverse();if(!G){v=M.slice(O.length),w=a.trim(v.replace(g,""));if(w===""||w.split(/\s+/).length<F.widow)return;u=A.pop()||"",O+=A.join(""),v=z.join("")+v}else v=D.find(J).remove().html(),O=D.html(),M=O+v,u="";F.moreLabel=D.find(K).length?"":o(F),H&&(v=M),O+=u,F.summary=O,F.details=v,F.lastCloseTag=u,B.onSlice&&(f=F.onSlice.call(C,F),F=f&&f.details?f:F);var P=n(F,H);D.html(P),x=D.find(J),y=D.find(K),x[F.collapseEffect](0),y.find("a").unbind("click.expander").bind("click.expander",Q),E=D.find("div."+F.summaryClass),F.userCollapse&&!D.find("span."+F.lessClass).length&&D.find(J).append('<span class="'+F.lessClass+'">'+F.userCollapsePrefix+'<a href="#">'+F.userCollapseText+"</a></span>"),D.find("span."+F.lessClass+" a").unbind("click.expander").bind("click.expander",function(b){b.preventDefault(),clearTimeout(l);var c=a(this).closest(J);q(F,c),B.onCollapse&&F.onCollapse.call(C,!0)})})},destroy:function(){if(!this.data("expander"))return;this.removeData("expander"),this.each(function(){var b=a(this),c=a.meta?a.extend({},d,b.data()):d,e=b.find("."+c.detailClass).contents();b.find("."+c.moreClass).remove(),b.find("."+c.summaryClass).remove(),b.find("."+c.detailClass).after(e).remove(),b.find("."+c.lessClass).remove()})}};return m[c]&&m[c].call(this),this},a.fn.expander.defaults=a.expander.defaults})(jQuery)
  59. ;function bindReviewContentExpander(){$("article.micro-home-review-item .desc").expander(),$(".reviews-main-item .desc").expander(),$("div.review-reply-item-content i").expander(),$('div.desc[itemprop="description"]').expander(),$("div.micro-home-expert-left .commentcontent").expander({slicePoint:480}),$('span[itemprop="description"]').expander()}$.expander.defaults={slicePoint:800,preserveWords:!0,widow:4,expandText:"Xem thêm...",expandPrefix:"… <br/>",summaryClass:"summary",detailClass:"details",moreClass:"read-more",lessClass:"read-less",collapseTimer:0,expandEffect:"fadeIn",expandSpeed:250,collapseEffect:"fadeOut",collapseSpeed:200,userCollapse:!1,userCollapseText:"",userCollapsePrefix:"",onSlice:null,beforeExpand:null,afterExpand:null,onCollapse:null},$(function(){bindReviewContentExpander()})
  60. ;function sendRequestViaMultiFriendSelector(){FB.ui({method:"apprequests",message:"Foody App Request",filters:["app_non_users"],data:"test"},requestCallback)}function requestCallback(a){}function loadSocialSharingPlugin(a){var b='<fb:like send="false" layout="button_count" href="'+a+'" width="120" show_faces="false"></fb:like>',c=encodeURIComponent(b),d='<div class="g-plusone" data-size="medium" href="'+a+'"></div><script type="text/javascript">(function () {var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;po.src = "https://apis.google.com/js/plusone.js";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);})();</script>',e=encodeURIComponent(d),f='<script src="//platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/Share" data-counter="right" data-url="'+a+'"></script>',g=encodeURIComponent(f);setTimeout(function(){jQuery("#facebook-like").append(decodeURIComponent(c)),jQuery("#google-like").append(decodeURIComponent(e)),jQuery("#linkedin-like").append(decodeURIComponent(g)),FB.XFBML.parse()},3e3)}function postToFacebookFeed(a){function d(a){}var b=$("#review-"+$(a).attr("reviewId")+" .desc").first().text(),c={method:"feed",link:decodeURIComponent($(a).attr("shareUrl")),picture:"",name:decodeURIComponent($(a).attr("shareName")),caption:"",description:b};FB.ui(c,null)}function postToGoogleFeed(a){var b="https://plus.google.com/share?url="+$(a).attr("shareUrl");return window.open(b,"","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600"),!1}function postToTwitterFeed(a){var b=$("#review-"+$(a).attr("reviewId")+" .desc").first().text(),c=$(a).attr("shareName");b=decodeURIComponent(c)+"\r\n"+b,b=b.substr(0,120);var d="https://twitter.com/intent/tweet?url="+$(a).attr("shareUrl")+"&text="+encodeURIComponent(b);return window.open(d,"","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600"),!1}function postToLinkedInFeed(a){var b=$("#review-"+$(a).attr("reviewId")+" .desc").first().text(),c=$(a).attr("shareName");b=b.substr(0,200);var d="http://www.linkedin.com/shareArticle?mini=true&url="+$(a).attr("shareUrl")+"&title="+c+"&summary="+encodeURIComponent(b)+"&source=Foody.vn";return window.open(d,"","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600"),!1}window.fbAsyncInit=function(){FB.init({appId:"395614663835338",channelUrl:"http://www.foody.vn/channel.html",status:!0,cookie:!0,xfbml:!0,frictionlessRequests:!0}),$(function(){var a=$("#fbLike");a.length>0&&FB.getLoginStatus(function(b){if(b.status=="not_authorized"||b.status=="connected"){var c=$.cookie("fbCookie");c?a.remove():$(document).mousemove(function(b){a.css({left:b.pageX-15+"px",top:b.pageY-3+"px"}),$(document.activeElement).attr("id")=="fbIframe"&&($.cookie("fbCookie","1",{expires:5,path:"/"}),$.cookie("fbPro",provinceId||217),a.remove())})}})})},function(a){var b,c="facebook-jssdk",d=a.getElementsByTagName("script")[0];if(a.getElementById(c))return;b=a.createElement("script"),b.id=c,b.async=!0,b.src="//connect.facebook.net/en_US/all.js",d.parentNode.insertBefore(b,d)}(document),function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://apis.google.com/js/plusone.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}(),$(function(){$(".facebook-invite-friend").click(function(){var a=new Date;$.ajax({type:"GET",url:"/Common/IsLogin?"+a.getTime(),success:function(a){a.success==1?sendRequestViaMultiFriendSelector():(loginSuccessCallback=sendRequestViaMultiFriendSelector,loginSocial(1))}})})})
  61. ;function BindingSuggestReviewTitle(){$('[data-autocomplete-type="reviews"]').autocomplete({delay:100,autoFocus:!1,html:!0,minLength:0,source:function(a,b){var c=a.term,d=this.element.data("autocomplete-type");typeof reviewcache[d]=="undefined"&&(reviewcache[d]={});if(c in reviewcache[d]){b(reviewcache[d][c]);return}reviewlastXhr=$.getJSON(this.element.data("autocomplete-url"),a,function(a,e,f){for(var g=0;g<a.length;g++)a[g].label=unescape(a[g].label);reviewcache[d][c]=a,f===reviewlastXhr&&b(a)})}})}var reviewcache={},reviewlastXhr;$('[data-autocomplete-type="reviews"]').live("focus",function(){$(this).val()==""?$('[data-autocomplete-type="reviews"]').autocomplete("search",""):$('[data-autocomplete-type="reviews"]').autocomplete("search",$(this).val())})
  62. ;var swfobject=function(){function A(){if(t)return;try{var a=i.getElementsByTagName("body")[0].appendChild(Q("span"));a.parentNode.removeChild(a)}catch(b){return}t=!0;var c=l.length;for(var d=0;d<c;d++)l[d]()}function B(a){t?a():l[l.length]=a}function C(b){if(typeof h.addEventListener!=a)h.addEventListener("load",b,!1);else if(typeof i.addEventListener!=a)i.addEventListener("load",b,!1);else if(typeof h.attachEvent!=a)R(h,"onload",b);else if(typeof h.onload=="function"){var c=h.onload;h.onload=function(){c(),b()}}else h.onload=b}function D(){k?E():F()}function E(){var c=i.getElementsByTagName("body")[0],d=Q(b);d.setAttribute("type",e);var f=c.appendChild(d);if(f){var g=0;(function(){if(typeof f.GetVariable!=a){var b=f.GetVariable("$version");b&&(b=b.split(" ")[1].split(","),y.pv=[parseInt(b[0],10),parseInt(b[1],10),parseInt(b[2],10)])}else if(g<10){g++,setTimeout(arguments.callee,10);return}c.removeChild(d),f=null,F()})()}else F()}function F(){var b=m.length;if(b>0)for(var c=0;c<b;c++){var d=m[c].id,e=m[c].callbackFn,f={success:!1,id:d};if(y.pv[0]>0){var g=P(d);if(g)if(S(m[c].swfVersion)&&!(y.wk&&y.wk<312))U(d,!0),e&&(f.success=!0,f.ref=G(d),e(f));else if(m[c].expressInstall&&H()){var h={};h.data=m[c].expressInstall,h.width=g.getAttribute("width")||"0",h.height=g.getAttribute("height")||"0",g.getAttribute("class")&&(h.styleclass=g.getAttribute("class")),g.getAttribute("align")&&(h.align=g.getAttribute("align"));var i={},j=g.getElementsByTagName("param"),k=j.length;for(var l=0;l<k;l++)j[l].getAttribute("name").toLowerCase()!="movie"&&(i[j[l].getAttribute("name")]=j[l].getAttribute("value"));I(h,i,d,e)}else J(g),e&&e(f)}else{U(d,!0);if(e){var n=G(d);n&&typeof n.SetVariable!=a&&(f.success=!0,f.ref=n),e(f)}}}}function G(c){var d=null,e=P(c);if(e&&e.nodeName=="OBJECT")if(typeof e.SetVariable!=a)d=e;else{var f=e.getElementsByTagName(b)[0];f&&(d=f)}return d}function H(){return!u&&S("6.0.65")&&(y.win||y.mac)&&!(y.wk&&y.wk<312)}function I(b,c,d,e){u=!0,r=e||null,s={success:!1,id:d};var g=P(d);if(g){g.nodeName=="OBJECT"?(p=K(g),q=null):(p=g,q=d),b.id=f;if(typeof b.width==a||!/%$/.test(b.width)&&parseInt(b.width,10)<310)b.width="310";if(typeof b.height==a||!/%$/.test(b.height)&&parseInt(b.height,10)<137)b.height="137";i.title=i.title.slice(0,47)+" - Flash Player Installation";var j=y.ie&&y.win?"ActiveX":"PlugIn",k="MMredirectURL="+h.location.toString().replace(/&/g,"%26")+"&MMplayerType="+j+"&MMdoctitle="+i.title;typeof c.flashvars!=a?c.flashvars+="&"+k:c.flashvars=k;if(y.ie&&y.win&&g.readyState!=4){var l=Q("div");d+="SWFObjectNew",l.setAttribute("id",d),g.parentNode.insertBefore(l,g),g.style.display="none",function(){g.readyState==4?g.parentNode.removeChild(g):setTimeout(arguments.callee,10)}()}L(b,c,d)}}function J(a){if(y.ie&&y.win&&a.readyState!=4){var b=Q("div");a.parentNode.insertBefore(b,a),b.parentNode.replaceChild(K(a),b),a.style.display="none",function(){a.readyState==4?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)}()}else a.parentNode.replaceChild(K(a),a)}function K(a){var c=Q("div");if(y.win&&y.ie)c.innerHTML=a.innerHTML;else{var d=a.getElementsByTagName(b)[0];if(d){var e=d.childNodes;if(e){var f=e.length;for(var g=0;g<f;g++)(e[g].nodeType!=1||e[g].nodeName!="PARAM")&&e[g].nodeType!=8&&c.appendChild(e[g].cloneNode(!0))}}}return c}function L(c,d,f){var g,h=P(f);if(y.wk&&y.wk<312)return g;if(h){typeof c.id==a&&(c.id=f);if(y.ie&&y.win){var i="";for(var j in c)c[j]!=Object.prototype[j]&&(j.toLowerCase()=="data"?d.movie=c[j]:j.toLowerCase()=="styleclass"?i+=' class="'+c[j]+'"':j.toLowerCase()!="classid"&&(i+=" "+j+'="'+c[j]+'"'));var k="";for(var l in d)d[l]!=Object.prototype[l]&&(k+='<param name="'+l+'" value="'+d[l]+'" />');h.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+i+">"+k+"</object>",n[n.length]=c.id,g=P(c.id)}else{var m=Q(b);m.setAttribute("type",e);for(var o in c)c[o]!=Object.prototype[o]&&(o.toLowerCase()=="styleclass"?m.setAttribute("class",c[o]):o.toLowerCase()!="classid"&&m.setAttribute(o,c[o]));for(var p in d)d[p]!=Object.prototype[p]&&p.toLowerCase()!="movie"&&M(m,p,d[p]);h.parentNode.replaceChild(m,h),g=m}}return g}function M(a,b,c){var d=Q("param");d.setAttribute("name",b),d.setAttribute("value",c),a.appendChild(d)}function N(a){var b=P(a);b&&b.nodeName=="OBJECT"&&(y.ie&&y.win?(b.style.display="none",function(){b.readyState==4?O(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function O(a){var b=P(a);if(b){for(var c in b)typeof b[c]=="function"&&(b[c]=null);b.parentNode.removeChild(b)}}function P(a){var b=null;try{b=i.getElementById(a)}catch(c){}return b}function Q(a){return i.createElement(a)}function R(a,b,c){a.attachEvent(b,c),o[o.length]=[a,b,c]}function S(a){var b=y.pv,c=a.split(".");return c[0]=parseInt(c[0],10),c[1]=parseInt(c[1],10)||0,c[2]=parseInt(c[2],10)||0,b[0]>c[0]||b[0]==c[0]&&b[1]>c[1]||b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]?!0:!1}function T(c,d,e,f){if(y.ie&&y.mac)return;var g=i.getElementsByTagName("head")[0];if(!g)return;var h=e&&typeof e=="string"?e:"screen";f&&(v=null,w=null);if(!v||w!=h){var j=Q("style");j.setAttribute("type","text/css"),j.setAttribute("media",h),v=g.appendChild(j),y.ie&&y.win&&typeof i.styleSheets!=a&&i.styleSheets.length>0&&(v=i.styleSheets[i.styleSheets.length-1]),w=h}y.ie&&y.win?v&&typeof v.addRule==b&&v.addRule(c,d):v&&typeof i.createTextNode!=a&&v.appendChild(i.createTextNode(c+" {"+d+"}"))}function U(a,b){if(!x)return;var c=b?"visible":"hidden";t&&P(a)?P(a).style.visibility=c:T("#"+a,"visibility:"+c)}function V(b){var c=/[\\\"<>\.;]/,d=c.exec(b)!=null;return d&&typeof encodeURIComponent!=a?encodeURIComponent(b):b}var a="undefined",b="object",c="Shockwave Flash",d="ShockwaveFlash.ShockwaveFlash",e="application/x-shockwave-flash",f="SWFObjectExprInst",g="onreadystatechange",h=window,i=document,j=navigator,k=!1,l=[D],m=[],n=[],o=[],p,q,r,s,t=!1,u=!1,v,w,x=!0,y=function(){var f=typeof i.getElementById!=a&&typeof i.getElementsByTagName!=a&&typeof i.createElement!=a,g=j.userAgent.toLowerCase(),l=j.platform.toLowerCase(),m=l?/win/.test(l):/win/.test(g),n=l?/mac/.test(l):/mac/.test(g),o=/webkit/.test(g)?parseFloat(g.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,p=!1,q=[0,0,0],r=null;if(typeof j.plugins!=a&&typeof j.plugins[c]==b)r=j.plugins[c].description,r&&(typeof j.mimeTypes==a||!j.mimeTypes[e]||!!j.mimeTypes[e].enabledPlugin)&&(k=!0,p=!1,r=r.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),q[0]=parseInt(r.replace(/^(.*)\..*$/,"$1"),10),q[1]=parseInt(r.replace(/^.*\.(.*)\s.*$/,"$1"),10),q[2]=/[a-zA-Z]/.test(r)?parseInt(r.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof h.ActiveXObject!=a)try{var s=new ActiveXObject(d);s&&(r=s.GetVariable("$version"),r&&(p=!0,r=r.split(" ")[1].split(","),q=[parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10)]))}catch(t){}return{w3:f,pv:q,wk:o,ie:p,win:m,mac:n}}(),z=function(){if(!y.w3)return;(typeof i.readyState!=a&&i.readyState=="complete"||typeof i.readyState==a&&(i.getElementsByTagName("body")[0]||i.body))&&A(),t||(typeof i.addEventListener!=a&&i.addEventListener("DOMContentLoaded",A,!1),y.ie&&y.win&&(i.attachEvent(g,function(){i.readyState=="complete"&&(i.detachEvent(g,arguments.callee),A())}),h==top&&function(){if(t)return;try{i.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}A()}()),y.wk&&function(){if(t)return;if(!/loaded|complete/.test(i.readyState)){setTimeout(arguments.callee,0);return}A()}(),C(A))}(),W=function(){y.ie&&y.win&&window.attachEvent("onunload",function(){var a=o.length;for(var b=0;b<a;b++)o[b][0].detachEvent(o[b][1],o[b][2]);var c=n.length;for(var d=0;d<c;d++)N(n[d]);for(var e in y)y[e]=null;y=null;for(var f in swfobject)swfobject[f]=null;swfobject=null})}();return{registerObject:function(a,b,c,d){if(y.w3&&a&&b){var e={};e.id=a,e.swfVersion=b,e.expressInstall=c,e.callbackFn=d,m[m.length]=e,U(a,!1)}else d&&d({success:!1,id:a})},getObjectById:function(a){if(y.w3)return G(a)},embedSWF:function(c,d,e,f,g,h,i,j,k,l){var m={success:!1,id:d};y.w3&&!(y.wk&&y.wk<312)&&c&&d&&e&&f&&g?(U(d,!1),B(function(){e+="",f+="";var n={};if(k&&typeof k===b)for(var o in k)n[o]=k[o];n.data=c,n.width=e,n.height=f;var p={};if(j&&typeof j===b)for(var q in j)p[q]=j[q];if(i&&typeof i===b)for(var r in i)typeof p.flashvars!=a?p.flashvars+="&"+r+"="+i[r]:p.flashvars=r+"="+i[r];if(S(g)){var s=L(n,p,d);n.id==d&&U(d,!0),m.success=!0,m.ref=s}else{if(h&&H()){n.data=h,I(n,p,d,l);return}U(d,!0)}l&&l(m)})):l&&l(m)},switchOffAutoHideShow:function(){x=!1},ua:y,getFlashPlayerVersion:function(){return{major:y.pv[0],minor:y.pv[1],release:y.pv[2]}},hasFlashPlayerVersion:S,createSWF:function(a,b,c){return y.w3?L(a,b,c):undefined},showExpressInstall:function(a,b,c,d){y.w3&&H()&&I(a,b,c,d)},removeSWF:function(a){y.w3&&N(a)},createCSS:function(a,b,c,d){y.w3&&T(a,b,c,d)},addDomLoadEvent:B,addLoadEvent:C,getQueryParamValue:function(a){var b=i.location.search||i.location.hash;if(b){/\?/.test(b)&&(b=b.split("?")[1]);if(a==null)return V(b);var c=b.split("&");for(var d=0;d<c.length;d++)if(c[d].substring(0,c[d].indexOf("="))==a)return V(c[d].substring(c[d].indexOf("=")+1))}return""},expressInstallCallback:function(){if(u){var a=P(f);a&&p&&(a.parentNode.replaceChild(p,a),q&&(U(q,!0),y.ie&&y.win&&(p.style.display="block")),r&&r(s)),u=!1}}}}(),SWFUpload;SWFUpload==undefined&&(SWFUpload=function(a){this.initSWFUpload(a)}),SWFUpload.prototype.initSWFUpload=function(a){try{this.customSettings={},this.settings=a,this.eventQueue=[],this.movieName="SWFUpload_"+SWFUpload.movieCount++,this.movieElement=null,SWFUpload.instances[this.movieName]=this,this.initSettings(),this.loadFlash(),this.displayDebugInfo()}catch(b){throw delete SWFUpload.instances[this.movieName],b}},SWFUpload.instances={},SWFUpload.movieCount=0,SWFUpload.version="2.2.0 2009-03-25",SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130},SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290},SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5},SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120},SWFUpload.CURSOR={ARROW:-1,HAND:-2},SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"},SWFUpload.completeURL=function(a){if(typeof a!="string"||a.match(/^https?:\/\//i)||a.match(/^\//))return a;var b=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),c=window.location.pathname.lastIndexOf("/");return c<=0?path="/":path=window.location.pathname.substr(0,c)+"/",path+a},SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(a,b){this.settings[a]=this.settings[a]==undefined?b:this.settings[a]},this.ensureDefault("upload_url",""),this.ensureDefault("preserve_relative_urls",!1),this.ensureDefault("file_post_name","Filedata"),this.ensureDefault("post_params",{}),this.ensureDefault("use_query_string",!1),this.ensureDefault("requeue_on_error",!1),this.ensureDefault("http_success",[]),this.ensureDefault("assume_success_timeout",0),this.ensureDefault("file_types","*.*"),this.ensureDefault("file_types_description","All Files"),this.ensureDefault("file_size_limit",0),this.ensureDefault("file_upload_limit",0),this.ensureDefault("file_queue_limit",0),this.ensureDefault("flash_url","swfupload.swf"),this.ensureDefault("prevent_swf_caching",!0),this.ensureDefault("button_image_url",""),this.ensureDefault("button_width",1),this.ensureDefault("button_height",1),this.ensureDefault("button_text",""),this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;"),this.ensureDefault("button_text_top_padding",0),this.ensureDefault("button_text_left_padding",0),this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES),this.ensureDefault("button_disabled",!1),this.ensureDefault("button_placeholder_id",""),this.ensureDefault("button_placeholder",null),this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW),this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW),this.ensureDefault("debug",!1),this.settings.debug_enabled=this.settings.debug,this.settings.return_upload_start_handler=this.returnUploadStart,this.ensureDefault("swfupload_loaded_handler",null),this.ensureDefault("file_dialog_start_handler",null),this.ensureDefault("file_queued_handler",null),this.ensureDefault("file_queue_error_handler",null),this.ensureDefault("file_dialog_complete_handler",null),this.ensureDefault("upload_start_handler",null),this.ensureDefault("upload_progress_handler",null),this.ensureDefault("upload_error_handler",null),this.ensureDefault("upload_success_handler",null),this.ensureDefault("upload_complete_handler",null),this.ensureDefault("debug_handler",this.debugMessage),this.ensureDefault("custom_settings",{}),this.customSettings=this.settings.custom_settings,!this.settings.prevent_swf_caching||(this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+(new Date).getTime()),this.settings.preserve_relative_urls||(this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url),this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)),delete this.ensureDefault},SWFUpload.prototype.loadFlash=function(){var a,b;if(document.getElementById(this.movieName)!==null)throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";a=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(a==undefined)throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;b=document.createElement("div"),b.innerHTML=this.getFlashHTML(),a.parentNode.replaceChild(b.firstChild,a),window[this.movieName]==undefined&&(window[this.movieName]=this.getMovieElement())},SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("")},SWFUpload.prototype.getFlashVars=function(){var a=this.buildParamString(),b=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(b),"&amp;assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&amp;params=",encodeURIComponent(a),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")},SWFUpload.prototype.getMovieElement=function(){this.movieElement==undefined&&(this.movieElement=document.getElementById(this.movieName));if(this.movieElement===null)throw"Could not find Flash element";return this.movieElement},SWFUpload.prototype.buildParamString=function(){var a=this.settings.post_params,b=[];if(typeof a=="object")for(var c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c.toString())+"="+encodeURIComponent(a[c].toString()));return b.join("&amp;")},SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,!1);var a=null;a=this.getMovieElement();if(a&&typeof a.CallFunction=="unknown"){for(var b in a)try{typeof a[b]=="function"&&(a[b]=null)}catch(c){}try{a.parentNode.removeChild(a)}catch(d){}}return window[this.movieName]=null,SWFUpload.instances[this.movieName]=null,delete SWFUpload.instances[this.movieName],this.movieElement=null,this.settings=null,this.customSettings=null,this.eventQueue=null,this.movieName=null,!0}catch(e){return!1}},SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error:         ",this.settings.requeue_on_error.toString(),"\n","\t","http_success:             ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout:   ",this.settings.assume_success_timeout,"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder:       ",this.settings.button_placeholder?"Set":"Not Set","\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler=="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler=="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler=="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler=="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler=="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler=="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler=="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler=="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler=="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler=="function").toString(),"\n"].join(""))},SWFUpload.prototype.addSetting=function(a,b,c){return b==undefined?this.settings[a]=c:this.settings[a]=b},SWFUpload.prototype.getSetting=function(a){return this.settings[a]!=undefined?this.settings[a]:""},SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement(),returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+"</invoke>"),returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"}return returnValue!=undefined&&typeof returnValue.post=="object"&&(returnValue=this.unescapeFilePostParams(returnValue)),returnValue},SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")},SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")},SWFUpload.prototype.startUpload=function(a){this.callFlash("StartUpload",[a])},SWFUpload.prototype.cancelUpload=function(a,b){b!==!1&&(b=!0),this.callFlash("CancelUpload",[a,b])},SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")},SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")},SWFUpload.prototype.setStats=function(a){this.callFlash("SetStats",[a])},SWFUpload.prototype.getFile=function(a){return typeof a=="number"?this.callFlash("GetFileByIndex",[a]):this.callFlash("GetFile",[a])},SWFUpload.prototype.addFileParam=function(a,b,c){return this.callFlash("AddFileParam",[a,b,c])},SWFUpload.prototype.removeFileParam=function(a,b){this.callFlash("RemoveFileParam",[a,b])},SWFUpload.prototype.setUploadURL=function(a){this.settings.upload_url=a.toString(),this.callFlash("SetUploadURL",[a])},SWFUpload.prototype.setPostParams=function(a){this.settings.post_params=a,this.callFlash("SetPostParams",[a])},SWFUpload.prototype.addPostParam=function(a,b){this.settings.post_params[a]=b,this.callFlash("SetPostParams",[this.settings.post_params])},SWFUpload.prototype.removePostParam=function(a){delete this.settings.post_params[a],this.callFlash("SetPostParams",[this.settings.post_params])},SWFUpload.prototype.setFileTypes=function(a,b){this.settings.file_types=a,this.settings.file_types_description=b,this.callFlash("SetFileTypes",[a,b])},SWFUpload.prototype.setFileSizeLimit=function(a){this.settings.file_size_limit=a,this.callFlash("SetFileSizeLimit",[a])},SWFUpload.prototype.setFileUploadLimit=function(a){this.settings.file_upload_limit=a,this.callFlash("SetFileUploadLimit",[a])},SWFUpload.prototype.setFileQueueLimit=function(a){this.settings.file_queue_limit=a,this.callFlash("SetFileQueueLimit",[a])},SWFUpload.prototype.setFilePostName=function(a){this.settings.file_post_name=a,this.callFlash("SetFilePostName",[a])},SWFUpload.prototype.setUseQueryString=function(a){this.settings.use_query_string=a,this.callFlash("SetUseQueryString",[a])},SWFUpload.prototype.setRequeueOnError=function(a){this.settings.requeue_on_error=a,this.callFlash("SetRequeueOnError",[a])},SWFUpload.prototype.setHTTPSuccess=function(a){typeof a=="string"&&(a=a.replace(" ","").split(",")),this.settings.http_success=a,this.callFlash("SetHTTPSuccess",[a])},SWFUpload.prototype.setAssumeSuccessTimeout=function(a){this.settings.assume_success_timeout=a,this.callFlash("SetAssumeSuccessTimeout",[a])},SWFUpload.prototype.setDebugEnabled=function(a){this.settings.debug_enabled=a,this.callFlash("SetDebugEnabled",[a])},SWFUpload.prototype.setButtonImageURL=function(a){a==undefined&&(a=""),this.settings.button_image_url=a,this.callFlash("SetButtonImageURL",[a])},SWFUpload.prototype.setButtonDimensions=function(a,b){this.settings.button_width=a,this.settings.button_height=b;var c=this.getMovieElement();c!=undefined&&(c.style.width=a+"px",c.style.height=b+"px"),this.callFlash("SetButtonDimensions",[a,b])},SWFUpload.prototype.setButtonText=function(a){this.settings.button_text=a,this.callFlash("SetButtonText",[a])},SWFUpload.prototype.setButtonTextPadding=function(a,b){this.settings.button_text_top_padding=b,this.settings.button_text_left_padding=a,this.callFlash("SetButtonTextPadding",[a,b])},SWFUpload.prototype.setButtonTextStyle=function(a){this.settings.button_text_style=a,this.callFlash("SetButtonTextStyle",[a])},SWFUpload.prototype.setButtonDisabled=function(a){this.settings.button_disabled=a,this.callFlash("SetButtonDisabled",[a])},SWFUpload.prototype.setButtonAction=function(a){this.settings.button_action=a,this.callFlash("SetButtonAction",[a])},SWFUpload.prototype.setButtonCursor=function(a){this.settings.button_cursor=a,this.callFlash("SetButtonCursor",[a])},SWFUpload.prototype.queueEvent=function(a,b){b==undefined?b=[]:b instanceof Array||(b=[b]);var c=this;if(typeof this.settings[a]=="function")this.eventQueue.push(function(){this.settings[a].apply(this,b)}),setTimeout(function(){c.executeNextEvent()},0);else if(this.settings[a]!==null)throw"Event handler "+a+" is unknown or is not a function"},SWFUpload.prototype.executeNextEvent=function(){var a=this.eventQueue?this.eventQueue.shift():null;typeof a=="function"&&a.apply(this)},SWFUpload.prototype.unescapeFilePostParams=function(a){var b=/[$]([0-9a-f]{4})/i,c={},d;if(a!=undefined){for(var e in a.post)if(a.post.hasOwnProperty(e)){d=e;var f;while((f=b.exec(d))!==null)d=d.replace(f[0],String.fromCharCode(parseInt("0x"+f[1],16)));c[d]=a.post[e]}a.post=c}return a},SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(a){return!1}},SWFUpload.prototype.flashReady=function(){var a=this.getMovieElement();if(!a){this.debug("Flash called back ready but the flash movie can't be found.");return}this.cleanUp(a),this.queueEvent("swfupload_loaded_handler")},SWFUpload.prototype.cleanUp=function(a){try{if(this.movieElement&&typeof a.CallFunction=="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var b in a)try{typeof a[b]=="function"&&(a[b]=null)}catch(c){}}}catch(d){}window.__flash__removeCallback=function(a,b){try{a&&(a[b]=null)}catch(c){}}},SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")},SWFUpload.prototype.fileQueued=function(a){a=this.unescapeFilePostParams(a),this.queueEvent("file_queued_handler",a)},SWFUpload.prototype.fileQueueError=function(a,b,c){a=this.unescapeFilePostParams(a),this.queueEvent("file_queue_error_handler",[a,b,c])},SWFUpload.prototype.fileDialogComplete=function(a,b,c){this.queueEvent("file_dialog_complete_handler",[a,b,c])},SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a),this.queueEvent("return_upload_start_handler",a)},SWFUpload.prototype.returnUploadStart=function(a){var b;if(typeof this.settings.upload_start_handler=="function")a=this.unescapeFilePostParams(a),b=this.settings.upload_start_handler.call(this,a);else if(this.settings.upload_start_handler!=undefined)throw"upload_start_handler must be a function";b===undefined&&(b=!0),b=!!b,this.callFlash("ReturnUploadStart",[b])},SWFUpload.prototype.uploadProgress=function(a,b,c){a=this.unescapeFilePostParams(a),this.queueEvent("upload_progress_handler",[a,b,c])},SWFUpload.prototype.uploadError=function(a,b,c){a=this.unescapeFilePostParams(a),this.queueEvent("upload_error_handler",[a,b,c])},SWFUpload.prototype.uploadSuccess=function(a,b,c){a=this.unescapeFilePostParams(a),this.queueEvent("upload_success_handler",[a,b,c])},SWFUpload.prototype.uploadComplete=function(a){a=this.unescapeFilePostParams(a),this.queueEvent("upload_complete_handler",a)},SWFUpload.prototype.debug=function(a){this.queueEvent("debug_handler",a)},SWFUpload.prototype.debugMessage=function(a){if(this.settings.debug){var b,c=[];if(typeof a=="object"&&typeof a.name=="string"&&typeof a.message=="string"){for(var d in a)a.hasOwnProperty(d)&&c.push(d+": "+a[d]);b=c.join("\n")||"",c=b.split("\n"),b="EXCEPTION: "+c.join("\nEXCEPTION: "),SWFUpload.Console.writeLine(b)}else SWFUpload.Console.writeLine(a)}},SWFUpload.Console={},SWFUpload.Console.writeLine=function(a){var b,c;try{b=document.getElementById("SWFUpload_Console"),b||(c=document.createElement("form"),document.getElementsByTagName("body")[0].appendChild(c),b=document.createElement("textarea"),b.id="SWFUpload_Console",b.style.fontFamily="monospace",b.setAttribute("wrap","off"),b.wrap="off",b.style.overflow="auto",b.style.width="700px",b.style.height="350px",b.style.margin="5px",c.appendChild(b)),b.value+=a+"\n",b.scrollTop=b.scrollHeight-b.clientHeight}catch(d){alert("Exception: "+d.name+" Message: "+d.message)}},function(a){var b={init:function(b,d){return this.each(function(){var e=a(this),f=e.clone(),g=a.extend({id:e.attr("id"),swf:"uploadify.swf",uploader:"uploadify.php",auto:!0,buttonClass:"",buttonCursor:"hand",buttonImage:null,buttonText:"SELECT FILES",checkExisting:!1,debug:!1,fileObjName:"Filedata",fileSizeLimit:0,fileTypeDesc:"All Files",fileTypeExts:"*.*",height:30,method:"post",multi:!0,formData:{},preventCaching:!0,progressData:"percentage",queueID:!1,queueSizeLimit:999,removeCompleted:!0,removeTimeout:3,requeueErrors:!1,successTimeout:300,uploadLimit:0,width:120,overrideEvents:[]},b),h={assume_success_timeout:g.successTimeout,button_placeholder_id:g.id,button_width:g.width,button_height:g.height,button_text:null,button_text_style:null,button_text_top_padding:0,button_text_left_padding:0,button_action:g.multi?SWFUpload.BUTTON_ACTION.SELECT_FILES:SWFUpload.BUTTON_ACTION.SELECT_FILE,button_disabled:!1,button_cursor:g.buttonCursor=="arrow"?SWFUpload.CURSOR.ARROW:SWFUpload.CURSOR.HAND,button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,debug:g.debug,requeue_on_error:g.requeueErrors,file_post_name:g.fileObjName,file_size_limit:g.fileSizeLimit,file_types:g.fileTypeExts,file_types_description:g.fileTypeDesc,file_queue_limit:g.queueSizeLimit,file_upload_limit:g.uploadLimit,flash_url:g.swf,prevent_swf_caching:g.preventCaching,post_params:g.formData,upload_url:g.uploader,use_query_string:g.method=="get",file_dialog_complete_handler:c.onDialogClose,file_dialog_start_handler:c.onDialogOpen,file_queued_handler:c.onSelect,file_queue_error_handler:c.onSelectError,swfupload_loaded_handler:g.onSWFReady,upload_complete_handler:c.onUploadComplete,upload_error_handler:c.onUploadError,upload_progress_handler:c.onUploadProgress,upload_start_handler:c.onUploadStart,upload_success_handler:c.onUploadSuccess};d&&(h=a.extend(h,d)),h=a.extend(h,g);var i=swfobject.getFlashPlayerVersion(),j=i.major>=9;if(j){window["uploadify_"+g.id]=new SWFUpload(h);var k=window["uploadify_"+g.id];e.data("uploadify",k);var l=a("<div />",{id:g.id,"class":"uploadify",css:{height:g.height+"px",width:g.width+"px"}});a("#"+k.movieName).wrap(l),l=a("#"+g.id),l.data("uploadify",k);var m=a("<div />",{id:g.id+"-button","class":"uploadify-button "+g.buttonClass});g.buttonImage&&m.css({"background-image":"url('"+g.buttonImage+"')","text-indent":"-9999px"}),m.html('<span class="uploadify-button-text">'+g.buttonText+"</span>").css({height:g.height+"px","line-height":g.height+"px",width:g.width+"px"}),l.append(m),a("#"+k.movieName).css({position:"absolute","z-index":1});if(!g.queueID){var n=a("<div />",{id:g.id+"-queue","class":"uploadify-queue"});l.after(n),k.settings.queueID=g.id+"-queue",k.settings.defaultQueue=!0}k.queueData={files:{},filesSelected:0,filesQueued:0,filesReplaced:0,filesCancelled:0,filesErrored:0,uploadsSuccessful:0,uploadsErrored:0,averageSpeed:0,queueLength:0,queueSize:0,uploadSize:0,queueBytesUploaded:0,uploadQueue:[],errorMsg:"Some files were not added to the queue:"},k.original=f,k.wrapper=l,k.button=m,k.queue=n,g.onInit&&g.onInit.call(e,k)}else g.onFallback&&g.onFallback.call(e)})},cancel:function(b,c){var d=arguments;this.each(function(){var b=a(this),c=b.data("uploadify"),e=c.settings,f=-1;if(d[0])if(d[0]=="*"){var g=c.queueData.queueLength;a("#"+e.queueID).find(".uploadify-queue-item").each(function(){f++,d[1]===!0?c.cancelUpload(a(this).attr("id"),!1):c.cancelUpload(a(this).attr("id")),a(this).find(".data").removeClass("data").html(" - Cancelled"),a(this).find(".uploadify-progress-bar").remove(),a(this).find(".uploadify-progress-bar-profile").remove(),a(this).delay(1e3+100*f).fadeOut(500,function(){a(this).remove()})}),c.queueData.queueSize=0,c.queueData.queueLength=0,e.onClearQueue&&e.onClearQueue.call(b,g)}else for(var h=0;h<d.length;h++)c.cancelUpload(d[h]),a("#"+d[h]).find(".data").removeClass("data").html(" - Cancelled"),a("#"+d[h]).find(".uploadify-progress-bar").remove(),a("#"+d[h]).find(".uploadify-progress-bar-profile").remove(),a("#"+d[h]).delay(1e3+100*h).fadeOut(50,function(){a(this).remove()});else{var i=a("#"+e.queueID).find(".uploadify-queue-item").get(0);$item=a(i),c.cancelUpload($item.attr("id")),$item.find(".data").removeClass("data").html(" - Cancelled"),$item.find(".uploadify-progress-bar").remove(),$item.find(".uploadify-progress-bar-profile").remove(),$item.delay(1e3).fadeOut(50,function(){a(this).remove()})}})},destroy:function(){this.each(function(){var b=a(this),c=b.data("uploadify"),d=c.settings;c.destroy(),d.defaultQueue&&a("#"+d.queueID).remove(),a("#"+d.id).replaceWith(c.original),d.onDestroy&&d.onDestroy.call(this),delete c})},disable:function(b){this.each(function(){var c=a(this),d=c.data("uploadify"),e=d.settings;b?(d.button.addClass("disabled"),e.onDisable&&e.onDisable.call(this)):(d.button.removeClass("disabled"),e.onEnable&&e.onEnable.call(this)),d.setButtonDisabled(b)})},settings:function(b,c,d){var e=arguments,f=c;this.each(function(){var g=a(this),h=g.data("uploadify"),i=h.settings;if(typeof e[0]=="object")for(var j in c)setData(j,c[j]);if(e.length===1)f=i[b];else{switch(b){case"uploader":h.setUploadURL(c);break;case"formData":d||(c=a.extend(i.formData,c)),h.setPostParams(i.formData);break;case"method":c=="get"?h.setUseQueryString(!0):h.setUseQueryString(!1);break;case"fileObjName":h.setFilePostName(c);break;case"fileTypeExts":h.setFileTypes(c,i.fileTypeDesc);break;case"fileTypeDesc":h.setFileTypes(i.fileTypeExts,c);break;case"fileSizeLimit":h.setFileSizeLimit(c);break;case"uploadLimit":h.setFileUploadLimit(c);break;case"queueSizeLimit":h.setFileQueueLimit(c);break;case"buttonImage":h.button.css("background-image",settingValue);break;case"buttonCursor":c=="arrow"?h.setButtonCursor(SWFUpload.CURSOR.ARROW):h.setButtonCursor(SWFUpload.CURSOR.HAND);break;case"buttonText":a("#"+i.id+"-button").find(".uploadify-button-text").html(c);break;case"width":h.setButtonDimensions(c,i.height);break;case"height":h.setButtonDimensions(i.width,c);break;case"multi":c?h.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES):h.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE)}i[b]=c}});if(e.length===1)return f},stop:function(){this.each(function(){var b=a(this),c=b.data("uploadify");c.queueData.averageSpeed=0,c.queueData.uploadSize=0,c.queueData.bytesUploaded=0,c.queueData.uploadQueue=[],c.stopUpload()})},upload:function(){var b=arguments;this.each(function(){var c=a(this),d=c.data("uploadify");d.queueData.averageSpeed=0,d.queueData.uploadSize=0,d.queueData.bytesUploaded=0,d.queueData.uploadQueue=[];if(b[0])if(b[0]=="*")d.queueData.uploadSize=d.queueData.queueSize,d.queueData.uploadQueue.push("*"),d.startUpload();else{for(var e=0;e<b.length;e++)d.queueData.uploadSize+=d.queueData.files[b[e]].size,d.queueData.uploadQueue.push(b[e]);d.startUpload(d.queueData.uploadQueue.shift())}else d.startUpload()})}},c={onDialogOpen:function(){var a=this.settings;this.queueData.errorMsg="Some files were not added to the queue:",this.queueData.filesReplaced=0,this.queueData.filesCancelled=0,a.onDialogOpen&&a.onDialogOpen.call(this)},onDialogClose:function(b,c,d){var e=this.settings;this.queueData.filesErrored=b-c,this.queueData.filesSelected=b,this.queueData.filesQueued=c-this.queueData.filesCancelled,this.queueData.queueLength=d,a.inArray("onDialogClose",e.overrideEvents)<0&&this.queueData.filesErrored>0&&alert(this.queueData.errorMsg),e.onDialogClose&&e.onDialogClose.call(this,this.queueData),e.auto&&a("#"+e.id).uploadify("upload","*")},onSelect:function(b){var c=this.settings,d=!1,e={};for(var f in this.queueData.files)e=this.queueData.files[f],e.uploaded!=1&&e.name==b.name&&(a("#"+e.id).remove(),this.cancelUpload(e.id),this.queueData.filesReplaced++);var g=Math.round(b.size/1024),h="KB";g>1e3&&(g=Math.round(g/1e3),h="MB");var i=g.toString().split(".");g=i[0],i.length>1&&(g+="."+i[1].substr(0,2)),g+=h;var j=b.name;j.length>25&&(j=j.substr(0,25)+"...");if(c.itemTemplate=="undefined"||c.itemTemplate==null||c.itemTemplate==0){if(a.inArray("onSelect",c.overrideEvents)<0){var k='<li class="template-upload uploadify-queue-item" id="'+b.id+'">'+'<div class="preview"><span class="fade"></span></div>';k+='<div class="picture-bar"><div class="progress progress-success progress-striped uploadify-progress active" style="width:auto;"><div class="uploadify-progress-bar bar" style="width:0%;height:10px;"></div></div><div style="font-size:11px;">Uploading...</div></div>',k+='<span class="data"></span>',k+='<div class="cancel remove"><a href="javascript:$(\'#'+c.id+"').uploadify('cancel', '"+b.id+"')\">X</a>"+"</div>"+"</li>",a("#"+c.queueID).append(k)}}else{itemData={fileID:b.id,instanceID:c.id,fileName:j,fileSize:g};if(a.inArray("onSelect",c.overrideEvents)<0){itemHTML=c.itemTemplate;for(var l in itemData)itemHTML=itemHTML.replace(new RegExp("\\$\\{"+l+"\\}","g"),itemData[l]);a("#"+c.queueID).append(itemHTML)}}this.queueData.queueSize+=b.size,this.queueData.files[b.id]=b,c.onSelect&&c.onSelect.apply(this,arguments)},onSelectError:function(b,c,d){var e=this.settings;if(a.inArray("onSelectError",e.overrideEvents)<0)switch(c){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:e.queueSizeLimit>d?this.queueData.errorMsg+="\nThe number of files selected exceeds the remaining upload limit ("+d+").":this.queueData.errorMsg+="\nThe number of files selected exceeds the queue size limit ("+e.queueSizeLimit+").";break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.queueData.errorMsg+='\nThe file "'+b.name+'" exceeds the size limit ('+e.fileSizeLimit+").";break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:this.queueData.errorMsg+='\nThe file "'+b.name+'" is empty.';break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.queueData.errorMsg+='\nThe file "'+b.name+'" is not an accepted file type ('+e.fileTypeDesc+")."}c!=SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED&&delete this.queueData.files[b.id],e.onSelectError&&e.onSelectError.apply(this,arguments)},onQueueComplete:function(){this.settings.onQueueComplete&&this.settings.onQueueComplete.call(this,this.settings.queueData)},onUploadComplete:function(b){var c=this.settings,d=this,e=this.getStats();this.queueData.queueLength=e.files_queued,this.queueData.uploadQueue[0]=="*"?this.queueData.queueLength>0?this.startUpload():(this.queueData.uploadQueue=[],c.onQueueComplete&&c.onQueueComplete.call(this,this.queueData)):this.queueData.uploadQueue.length>0?this.startUpload(this.queueData.uploadQueue.shift()):(this.queueData.uploadQueue=[],c.onQueueComplete&&c.onQueueComplete.call(this,this.queueData));if(a.inArray("onUploadComplete",c.overrideEvents)<0)if(c.removeCompleted)switch(b.filestatus){case SWFUpload.FILE_STATUS.COMPLETE:setTimeout(function(){a("#"+b.id)&&(d.queueData.queueSize-=b.size,d.queueData.queueLength-=1,delete d.queueData.files[b.id],a("#"+b.id).fadeOut(500,function(){a(this).remove()}))},c.removeTimeout*1e3);break;case SWFUpload.FILE_STATUS.ERROR:c.requeueErrors||setTimeout(function(){a("#"+b.id)&&(d.queueData.queueSize-=b.size,d.queueData.queueLength-=1,delete d.queueData.files[b.id],a("#"+b.id).fadeOut(500,function(){a(this).remove()}))},c.removeTimeout*1e3)}else b.uploaded=!0;c.onUploadComplete&&c.onUploadComplete.call(this,b)},onUploadError:function(b,c,d){var e=this.settings,f="Error";switch(c){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:f="HTTP Error ("+d+")";break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:f="Missing Upload URL";break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:f="IO Error";break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:f="Security Error";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:alert("The upload limit has been reached ("+d+")."),f="Exceeds Upload Limit";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:f="Failed";break;case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:f="Validation Error";break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:f="Cancelled",this.queueData.queueSize-=b.size,this.queueData.queueLength-=1;if(b.status==SWFUpload.FILE_STATUS.IN_PROGRESS||a.inArray(b.id,this.queueData.uploadQueue)>=0)this.queueData.uploadSize-=b.size;e.onCancel&&e.onCancel.call(this,b),delete this.queueData.files[b.id];break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:f="Stopped"}a.inArray("onUploadError",e.overrideEvents)<0&&(c!=SWFUpload.UPLOAD_ERROR.FILE_CANCELLED&&c!=SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED&&a("#"+b.id).addClass("uploadify-error"),a("#"+b.id).find(".uploadify-progress-bar").css("width","1px"),a("#"+b.id).find(".uploadify-progress-bar-profile").css("width","1px"),c!=SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND&&b.status!=SWFUpload.FILE_STATUS.COMPLETE&&a("#"+b.id).find(".data").html(" - "+f));var g=this.getStats();this.queueData.uploadsErrored=g.upload_errors,e.onUploadError&&e.onUploadError.call(this,b,c,d,f)},onUploadProgress:function(b,c,d){var e=this.settings,f=new Date,g=f.getTime(),h=g-this.timer;h>500&&(this.timer=g);var i=c-this.bytesLoaded;this.bytesLoaded=c;var j=this.queueData.queueBytesUploaded+c,k=Math.round(c/d*100),l="KB/s",m=0,n=i/1024/(h/1e3);n=Math.floor(n*10)/10,this.queueData.averageSpeed>0?this.queueData.averageSpeed=Math.floor((this.queueData.averageSpeed+n)/2):this.queueData.averageSpeed=Math.floor(n),n>1e3&&(m=n*.001,this.queueData.averageSpeed=Math.floor(m),l="MB/s"),a.inArray("onUploadProgress",e.overrideEvents)<0&&(e.progressData!="percentage"&&!(e.progressData=="speed"&&h>500),a("#"+b.id).find(".uploadify-progress-bar").css("width",k+"%"),a("#"+b.id).find(".uploadify-progress-bar-profile").css("width",k+"%")),e.onUploadProgress&&e.onUploadProgress.call(this,b,c,d,j,this.queueData.uploadSize)},onUploadStart:function(b){var c=this.settings,d=new Date;this.timer=d.getTime(),this.bytesLoaded=0,this.queueData.uploadQueue.length==0&&(this.queueData.uploadSize=b.size),c.checkExisting&&a.ajax({type:"POST",async:!1,url:c.checkExisting,data:{filename:b.name},success:function(c){if(c==1){var d=confirm('A file with the name "'+b.name+'" already exists on the server.\nWould you like to replace the existing file?');d||(this.cancelUpload(b.id),a("#"+b.id).remove(),this.queueData.uploadQueue.length>0&&this.queueData.queueLength>0&&(this.queueData.uploadQueue[0]=="*"?this.startUpload():this.startUpload(this.queueData.uploadQueue.shift())))}}}),c.onUploadStart&&c.onUploadStart.call(this,b)},onUploadSuccess:function(b,c,d){var e=this.settings,f=this.getStats();this.queueData.uploadsSuccessful=f.successful_uploads,this.queueData.queueBytesUploaded+=b.size,!(a.inArray("onUploadSuccess",e.overrideEvents)<0),e.onUploadSuccess&&e.onUploadSuccess.call(this,b,c,d)}};a.fn.uploadify=function(c){if(b[c])return b[c].apply(this,Array.prototype.slice.call(arguments,1));if(typeof c=="object"||!c)return b.init.apply(this,arguments);a.error("The method "+c+" does not exist in $.uploadify")}}($)
  63. ;(function(a){"use strict";var b=function(a,c,d){var e=document.createElement("img"),f,g;return e.onerror=c,e.onload=function(){g&&b.revokeObjectURL(g),c(b.scale(e,d))},window.Blob&&a instanceof Blob||window.File&&a instanceof File?f=g=b.createObjectURL(a):f=a,f?(e.src=f,e):b.readFile(a,function(a){e.src=a})},c=window.createObjectURL&&window||window.URL&&URL||window.webkitURL&&webkitURL;b.scale=function(a,b){b=b||{};var c=document.createElement("canvas"),d=Math.max((b.minWidth||a.width)/a.width,(b.minHeight||a.height)/a.height);return d>1&&(a.width=parseInt(a.width*d,10),a.height=parseInt(a.height*d,10)),d=Math.min((b.maxWidth||a.width)/a.width,(b.maxHeight||a.height)/a.height),d<1&&(a.width=parseInt(a.width*d,10),a.height=parseInt(a.height*d,10)),!b.canvas||!c.getContext?a:(c.width=a.width,c.height=a.height,c.getContext("2d").drawImage(a,0,0,a.width,a.height),c)},b.createObjectURL=function(a){return c?c.createObjectURL(a):!1},b.revokeObjectURL=function(a){return c?c.revokeObjectURL(a):!1},b.readFile=function(a,b){if(window.FileReader&&FileReader.prototype.readAsDataURL){var c=new FileReader;return c.onload=function(a){b(a.target.result)},c.readAsDataURL(a),c}return!1},typeof define!="undefined"&&define.amd?define(function(){return b}):a.loadImage=b})(this);
  64. ;(function(a){"use strict";var b=function(a,c){var d=/[^\w\-\.:]/.test(a)?new Function(b.arg+",tmpl","var _e=tmpl.encode"+b.helper+",_s='"+a.replace(b.regexp,b.func)+"';return _s;"):b.cache[a]=b.cache[a]||b(b.load(a));return c?d(c,b):function(a){return d(a,b)}};b.cache={},b.load=function(a){return document.getElementById(a).innerHTML},b.regexp=/([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,b.func=function(a,b,c,d,e,f){if(b)return{"\n":"\\n","\r":"\\r","\t":"\\t"," ":" "}[a]||"\\"+a;if(c)return c==="="?"'+_e("+d+")+'":"'+("+d+"||'')+'";if(e)return"';";if(f)return"_s+='"},b.encReg=/[<>&"'\x00]/g,b.encMap={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#39;"},b.encode=function(a){return String(a||"").replace(b.encReg,function(a){return b.encMap[a]||""})},b.arg="o",b.helper=",print=function(s,e){_s+=e&&(s||'')||_e(s);},include=function(s,d){_s+=tmpl(s,d);}",typeof define=="function"&&define.amd?define(function(){return b}):a.tmpl=b})(this);
  65. ;(function(a){"use strict",typeof define=="function"&&define.amd?define(["jquery","jquery.ui.widget"],a):a(window.jQuery)})(function(a){"use strict",a.support.xhrFileUpload=!!window.XMLHttpRequestUpload&&!!window.FileReader,a.support.xhrFormDataFileUpload=!!window.FormData,a.widget("blueimp.fileupload",{options:{namespace:undefined,dropZone:a(document),fileInput:undefined,replaceFileInput:!0,paramName:undefined,singleFileUploads:!0,limitMultiFileUploads:undefined,sequentialUploads:!1,limitConcurrentUploads:undefined,forceIframeTransport:!1,redirect:undefined,redirectParamName:undefined,postMessage:undefined,multipart:!0,maxChunkSize:undefined,uploadedBytes:undefined,recalculateProgress:!0,formData:function(a){return a.serializeArray()},add:function(a,b){b.submit()},processData:!1,contentType:!1,cache:!1},_refreshOptionsList:["namespace","dropZone","fileInput","multipart","forceIframeTransport"],_isXHRUpload:function(b){return!b.forceIframeTransport&&(!b.multipart&&a.support.xhrFileUpload||a.support.xhrFormDataFileUpload)},_getFormData:function(b){var c;return typeof b.formData=="function"?b.formData(b.form):a.isArray(b.formData)?b.formData:b.formData?(c=[],a.each(b.formData,function(a,b){c.push({name:a,value:b})}),c):[]},_getTotal:function(b){var c=0;return a.each(b,function(a,b){c+=b.size||1}),c},_onProgress:function(a,b){if(a.lengthComputable){var c=b.total||this._getTotal(b.files),d=parseInt(a.loaded/a.total*(b.chunkSize||c),10)+(b.uploadedBytes||0);this._loaded+=d-(b.loaded||b.uploadedBytes||0),b.lengthComputable=!0,b.loaded=d,b.total=c,this._trigger("progress",a,b),this._trigger("progressall",a,{lengthComputable:!0,loaded:this._loaded,total:this._total})}},_initProgressListener:function(b){var c=this,d=b.xhr?b.xhr():a.ajaxSettings.xhr();d.upload&&(a(d.upload).bind("progress",function(a){var d=a.originalEvent;a.lengthComputable=d.lengthComputable,a.loaded=d.loaded,a.total=d.total,c._onProgress(a,b)}),b.xhr=function(){return d})},_initXHRData:function(b){var c,d=b.files[0],e=b.multipart||!a.support.xhrFileUpload;if(!e||b.blob)b.headers=a.extend(b.headers,{"X-File-Name":d.name,"X-File-Type":d.type,"X-File-Size":d.size}),b.blob?e||(b.contentType="application/octet-stream",b.data=b.blob):(b.contentType=d.type,b.data=d);e&&a.support.xhrFormDataFileUpload&&(b.postMessage?(c=this._getFormData(b),b.blob?c.push({name:b.paramName,value:b.blob}):a.each(b.files,function(a,d){c.push({name:b.paramName,value:d})})):(b.formData instanceof FormData?c=b.formData:(c=new FormData,a.each(this._getFormData(b),function(a,b){c.append(b.name,b.value)})),b.blob?c.append(b.paramName,b.blob,d.name):a.each(b.files,function(a,d){d instanceof Blob&&c.append(b.paramName,d,d.name)})),b.data=c),b.blob=null},_initIframeSettings:function(b){b.dataType="iframe "+(b.dataType||""),b.formData=this._getFormData(b),b.redirect&&a("<a></a>").prop("href",b.url).prop("host")!==location.host&&b.formData.push({name:b.redirectParamName||"redirect",value:b.redirect})},_initDataSettings:function(a){this._isXHRUpload(a)?(this._chunkedUpload(a,!0)||(a.data||this._initXHRData(a),this._initProgressListener(a)),a.postMessage&&(a.dataType="postmessage "+(a.dataType||""))):this._initIframeSettings(a,"iframe")},_initFormSettings:function(b){if(!b.form||!b.form.length)b.form=a(b.fileInput.prop("form"));b.paramName||(b.paramName=b.fileInput.prop("name")||"files[]"),b.url||(b.url=b.form.prop("action")||location.href),b.type=(b.type||b.form.prop("method")||"").toUpperCase(),b.type!=="POST"&&b.type!=="PUT"&&(b.type="POST")},_getAJAXSettings:function(b){var c=a.extend({},this.options,b);return this._initFormSettings(c),this._initDataSettings(c),c},_enhancePromise:function(a){return a.success=a.done,a.error=a.fail,a.complete=a.always,a},_getXHRPromise:function(b,c,d){var e=a.Deferred(),f=e.promise();return c=c||this.options.context||f,b===!0?e.resolveWith(c,d):b===!1&&e.rejectWith(c,d),f.abort=e.promise,this._enhancePromise(f)},_chunkedUpload:function(b,c){var d=this,e=b.files[0],f=e.size,g=b.uploadedBytes=b.uploadedBytes||0,h=b.maxChunkSize||f,i=e.webkitSlice||e.mozSlice||e.slice,j,k,l,m;return!(this._isXHRUpload(b)&&i&&(g||h<f))||b.data?!1:c?!0:g>=f?(e.error="uploadedBytes",this._getXHRPromise(!1,b.context,[null,"error",e.error])):(k=Math.ceil((f-g)/h),j=function(c){return c?j(c-=1).pipe(function(){var f=a.extend({},b);return f.blob=i.call(e,g+c*h,g+(c+1)*h),f.chunkSize=f.blob.size,d._initXHRData(f),d._initProgressListener(f),l=(a.ajax(f)||d._getXHRPromise(!1,f.context)).done(function(){f.loaded||d._onProgress(a.Event("progress",{lengthComputable:!0,loaded:f.chunkSize,total:f.chunkSize}),f),b.uploadedBytes=f.uploadedBytes+=f.chunkSize}),l}):d._getXHRPromise(!0,b.context)},m=j(k),m.abort=function(){return l.abort()},this._enhancePromise(m))},_beforeSend:function(a,b){this._active===0&&this._trigger("start"),this._active+=1,this._loaded+=b.uploadedBytes||0,this._total+=this._getTotal(b.files)},_onDone:function(b,c,d,e){this._isXHRUpload(e)||this._onProgress(a.Event("progress",{lengthComputable:!0,loaded:1,total:1}),e),e.result=b,e.textStatus=c,e.jqXHR=d,this._trigger("done",null,e)},_onFail:function(a,b,c,d){d.jqXHR=a,d.textStatus=b,d.errorThrown=c,this._trigger("fail",null,d),d.recalculateProgress&&(this._loaded-=d.loaded||d.uploadedBytes||0,this._total-=d.total||this._getTotal(d.files))},_onAlways:function(a,b,c,d){this._active-=1,d.textStatus=b,c&&c.always?(d.jqXHR=c,d.result=a):(d.jqXHR=a,d.errorThrown=c),this._trigger("always",null,d),this._active===0&&(this._trigger("stop"),this._loaded=this._total=0)},_onSend:function(b,c){var d=this,e,f,g,h=d._getAJAXSettings(c),i=function(c,f){return d._sending+=1,e=e||(c!==!1&&d._trigger("send",b,h)!==!1&&(d._chunkedUpload(h)||a.ajax(h))||d._getXHRPromise(!1,h.context,f)).done(function(a,b,c){d._onDone(a,b,c,h)}).fail(function(a,b,c){d._onFail(a,b,c,h)}).always(function(a,b,c){d._sending-=1,d._onAlways(a,b,c,h);if(h.limitConcurrentUploads&&h.limitConcurrentUploads>d._sending){var e=d._slots.shift();while(e){if(!e.isRejected()){e.resolve();break}e=d._slots.shift()}}}),e};return this._beforeSend(b,h),this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending?(this.options.limitConcurrentUploads>1?(f=a.Deferred(),this._slots.push(f),g=f.pipe(i)):g=this._sequence=this._sequence.pipe(i,i),g.abort=function(){var a=[undefined,"abort","abort"];return e?e.abort():(f&&f.rejectWith(a),i(!1,a))},this._enhancePromise(g)):i()},_onAdd:function(b,c){var d=this,e=!0,f=a.extend({},this.options,c),g=f.limitMultiFileUploads,h,i;if(!f.singleFileUploads&&!g||!this._isXHRUpload(f))h=[c.files];else if(!f.singleFileUploads&&g){h=[];for(i=0;i<c.files.length;i+=g)h.push(c.files.slice(i,i+g))}return c.originalFiles=c.files,a.each(h||c.files,function(f,g){var i=h?g:[g],j=a.extend({},c,{files:i});return j.submit=function(){return j.jqXHR=this.jqXHR=d._trigger("submit",b,this)!==!1&&d._onSend(b,this),this.jqXHR},e=d._trigger("add",b,j)}),e},_normalizeFile:function(a,b){b.name===undefined&&b.size===undefined&&(b.name=b.fileName,b.size=b.fileSize)},_replaceFileInput:function(b){var c=b.clone(!0);a("<form></form>").append(c)[0].reset(),b.after(c).detach(),a.cleanData(b.unbind("remove")),this.options.fileInput=this.options.fileInput.map(function(a,d){return d===b[0]?c[0]:d}),b[0]===this.element[0]&&(this.element=c)},_onChange:function(b){var c=b.data.fileupload,d={files:a.each(a.makeArray(b.target.files),c._normalizeFile),fileInput:a(b.target),form:a(b.target.form)};d.files.length||(d.files=[{name:b.target.value.replace(/^.*\\/,"")}]),c.options.replaceFileInput&&c._replaceFileInput(d.fileInput);if(c._trigger("change",b,d)===!1||c._onAdd(b,d)===!1)return!1},_onPaste:function(b){var c=b.data.fileupload,d=b.originalEvent.clipboardData,e=d&&d.items||[],f={files:[]};a.each(e,function(a,b){var c=b.getAsFile&&b.getAsFile();c&&f.files.push(c)});if(c._trigger("paste",b,f)===!1||c._onAdd(b,f)===!1)return!1},_onDrop:function(b){var c=b.data.fileupload,d=b.dataTransfer=b.originalEvent.dataTransfer,e={files:a.each(a.makeArray(d&&d.files),c._normalizeFile)};if(c._trigger("drop",b,e)===!1||c._onAdd(b,e)===!1)return!1;b.preventDefault()},_onDragOver:function(a){var b=a.data.fileupload,c=a.dataTransfer=a.originalEvent.dataTransfer;if(b._trigger("dragover",a)===!1)return!1;c&&(c.dropEffect=c.effectAllowed="copy"),a.preventDefault()},_initEventHandlers:function(){var a=this.options.namespace;this._isXHRUpload(this.options)&&this.options.dropZone.bind("dragover."+a,{fileupload:this},this._onDragOver).bind("drop."+a,{fileupload:this},this._onDrop),this.options.fileInput.bind("change."+a,{fileupload:this},this._onChange)},_destroyEventHandlers:function(){var a=this.options.namespace;this.options.dropZone.unbind("dragover."+a,this._onDragOver).unbind("drop."+a,this._onDrop).unbind("paste."+a,this._onPaste),this.options.fileInput.unbind("change."+a,this._onChange)},_setOption:function(b,c){var d=a.inArray(b,this._refreshOptionsList)!==-1;d&&this._destroyEventHandlers(),a.Widget.prototype._setOption.call(this,b,c),d&&(this._initSpecialOptions(),this._initEventHandlers())},_initSpecialOptions:function(){var b=this.options;b.fileInput===undefined?b.fileInput=this.element.is("input:file")?this.element:this.element.find("input:file"):b.fileInput instanceof a||(b.fileInput=a(b.fileInput)),b.dropZone instanceof a||(b.dropZone=a(b.dropZone))},_create:function(){var b=this.options,c=a.extend({},this.element.data());c[this.widgetName]=undefined,a.extend(b,c),b.namespace=b.namespace||this.widgetName,this._initSpecialOptions(),this._slots=[],this._sequence=this._getXHRPromise(!0),this._sending=this._active=this._loaded=this._total=0,this._initEventHandlers()},destroy:function(){this._destroyEventHandlers(),a.Widget.prototype.destroy.call(this)},enable:function(){a.Widget.prototype.enable.call(this),this._initEventHandlers()},disable:function(){this._destroyEventHandlers(),a.Widget.prototype.disable.call(this)},add:function(b){if(!b||this.options.disabled)return;b.files=a.each(a.makeArray(b.files),this._normalizeFile),this._onAdd(null,b)},send:function(b){if(b&&!this.options.disabled){b.files=a.each(a.makeArray(b.files),this._normalizeFile);if(b.files.length)return this._onSend(null,b)}return this._getXHRPromise(!1,b&&b.context)}})})
  66. ;(function(a){"use strict",typeof define=="function"&&define.amd?define(["jquery"],a):a(window.jQuery)})(function(a){"use strict";var b=0;a.ajaxTransport("iframe",function(c){if(c.async&&(c.type==="POST"||c.type==="GET")){var d,e;return{send:function(f,g){d=a('<form style="display:none;"></form>'),e=a('<iframe src="javascript:false;" name="iframe-transport-'+(b+=1)+'"></iframe>').bind("load",function(){var b;e.unbind("load").bind("load",function(){var b;try{b=e.contents();if(!b.length||!b[0].firstChild)throw new Error}catch(c){b=undefined}g(200,"success",{iframe:b}),a('<iframe src="javascript:false;"></iframe>').appendTo(d),d.remove()}),d.prop("target",e.prop("name")).prop("action",c.url).prop("method",c.type),c.formData&&a.each(c.formData,function(b,c){a('<input type="hidden"/>').prop("name",c.name).val(c.value).appendTo(d)}),c.fileInput&&c.fileInput.length&&c.type==="POST"&&(b=c.fileInput.clone(),c.fileInput.after(function(a){return b[a]}),c.paramName&&c.fileInput.each(function(){a(this).prop("name",c.paramName)}),d.append(c.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data")),d.submit(),b&&b.length&&c.fileInput.each(function(c,d){var e=a(b[c]);a(d).prop("name",e.prop("name")),e.replaceWith(d)})}),d.append(e).appendTo(document.body)},abort:function(){e&&e.unbind("load").prop("src","javascript".concat(":false;")),d&&d.remove()}}}}),a.ajaxSetup({converters:{"iframe text":function(b){return a(b[0].body).text()},"iframe json":function(b){return a.parseJSON(a(b[0].body).text())},"iframe html":function(b){return a(b[0].body).html()},"iframe script":function(b){return a.globalEval(a(b[0].body).text())}}})})
  67. ;(function(a){"use strict",typeof define=="function"&&define.amd?define(["jquery","load-image","canvas-to-blob","./jquery.fileupload"],a):a(window.jQuery,window.loadImage,window.canvasToBlob)})(function(a,b,c){"use strict",a.widget("blueimpIP.fileupload",a.blueimp.fileupload,{options:{resizeSourceFileTypes:/^image\/(gif|jpeg|png)$/,resizeSourceMaxFileSize:2e7,resizeMaxWidth:undefined,resizeMaxHeight:undefined,resizeMinWidth:undefined,resizeMinHeight:undefined,add:function(b,c){a(this).fileupload("resize",c).done(function(){c.submit()})}},_resizeImage:function(d,e,f){var g=this,h=d[e],i=a.Deferred(),j,k;return f=f||this.options,b(h,function(a){var k=a.width,l=a.height;j=b.scale(a,{maxWidth:f.resizeMaxWidth,maxHeight:f.resizeMaxHeight,minWidth:f.resizeMinWidth,minHeight:f.resizeMinHeight,canvas:!0}),k!==j.width||l!==j.height?c(j,function(a){a.name||(h.type===a.type?a.name=h.name:h.name&&(a.name=h.name.replace(/\..+$/,"."+a.type.substr(6)))),d[e]=a,i.resolveWith(g)},h):i.resolveWith(g)}),i.promise()},resize:function(b){var c=this,d=a.extend({},this.options,b),e=a.type(d.resizeSourceMaxFileSize)!=="number",f=this._isXHRUpload(d);return a.each(b.files,function(g,h){f&&c._resizeSupport&&(d.resizeMaxWidth||d.resizeMaxHeight||d.resizeMinWidth||d.resizeMinHeight)&&(e||h.size<d.resizeSourceMaxFileSize)&&d.resizeSourceFileTypes.test(h.type)&&(c._processing+=1,c._processing===1&&c.element.addClass("fileupload-processing"),c._processingQueue=c._processingQueue.pipe(function(){var e=a.Deferred();return c._resizeImage(b.files,g,d).done(function(){c._processing-=1,c._processing===0&&c.element.removeClass("fileupload-processing"),e.resolveWith(c)}),e.promise()}))}),this._processingQueue},_create:function(){a.blueimp.fileupload.prototype._create.call(this),this._processing=0,this._processingQueue=a.Deferred().resolveWith(this).promise(),this._resizeSupport=c&&c(document.createElement("canvas"),a.noop)}})})
  68. ;(function(a){"use strict",typeof define=="function"&&define.amd?define(["jquery","tmpl","load-image","./jquery.fileupload-ip"],a):a(window.jQuery,window.tmpl,window.loadImage)})(function(a,b,c){"use strict";var d=(a.blueimpIP||a.blueimp).fileupload;a.widget("blueimpUI.fileupload",d,{options:{autoUpload:!1,maxNumberOfFiles:undefined,maxFileSize:undefined,minFileSize:undefined,acceptFileTypes:/.+$/i,previewSourceFileTypes:/^image\/(gif|jpeg|png)$/,previewSourceMaxFileSize:5e6,previewMaxWidth:60,previewMaxHeight:40,previewAsCanvas:!1,uploadTemplateId:"template-upload",downloadTemplateId:"template-download",dataType:"json",add:function(b,c){var d=a(this).data("fileupload"),e=d.options,f=c.files;d._adjustMaxNumberOfFiles(-f.length),c.isAdjusted=!0,a(this).fileupload("resize",c).done(c,function(){c.files.valid=c.isValidated=d._validate(f),c.context=d._renderUpload(f).appendTo(e.filesContainer).data("data",c),d._renderPreviews(f,c.context),d._forceReflow(c.context),d._transition(c.context).done(function(){d._trigger("added",b,c)!==!1&&(e.autoUpload||c.autoUpload)&&c.autoUpload!==!1&&c.isValidated&&c.submit()})})},send:function(b,c){var d=a(this).data("fileupload");if(!c.isValidated){c.isAdjusted||d._adjustMaxNumberOfFiles(-c.files.length);if(!d._validate(c.files))return!1}return c.context&&c.dataType&&c.dataType.substr(0,6)==="iframe"&&c.context.find(".progress").addClass(!a.support.transition&&"progress-animated").find(".bar").css("width",parseInt(100,10)+"%"),d._trigger("sent",b,c)},done:function(b,c){var d=a(this).data("fileupload"),e,f;c.context?c.context.each(function(f){var g=a.isArray(c.result)&&c.result[f]||{error:"emptyResult"};g.error&&d._adjustMaxNumberOfFiles(1),d._transition(a(this)).done(function(){var f=a(this);e=d._renderDownload([g]).css("height",f.height()).replaceAll(f),d._forceReflow(e),d._transition(e).done(function(){c.context=a(this),d._trigger("completed",b,c)})})}):(e=d._renderDownload(c.result).appendTo(d.options.filesContainer),d._forceReflow(e),d._transition(e).done(function(){c.context=a(this),d._trigger("completed",b,c)}))},fail:function(b,c){var d=a(this).data("fileupload"),e;d._adjustMaxNumberOfFiles(c.files.length),c.context?c.context.each(function(f){if(c.errorThrown!=="abort"){var g=c.files[f];g.error=g.error||c.errorThrown||!0,d._transition(a(this)).done(function(){var f=a(this);e=d._renderDownload([g]).replaceAll(f),d._forceReflow(e),d._transition(e).done(function(){c.context=a(this),d._trigger("failed",b,c)})})}else d._transition(a(this)).done(function(){a(this).remove(),d._trigger("failed",b,c)})}):c.errorThrown!=="abort"?(d._adjustMaxNumberOfFiles(-c.files.length),c.context=d._renderUpload(c.files).appendTo(d.options.filesContainer).data("data",c),d._forceReflow(c.context),d._transition(c.context).done(function(){c.context=a(this),d._trigger("failed",b,c)})):d._trigger("failed",b,c)},progress:function(a,b){b.context&&b.context.find(".progress .bar").css("width",parseInt(b.loaded/b.total*100,10)+"%")},progressall:function(b,c){a(this).find(".fileupload-buttonbar .progress .bar").css("width",parseInt(c.loaded/c.total*100,10)+"%")},start:function(b){var c=a(this).data("fileupload");c._transition(a(this).find(".fileupload-buttonbar .progress")).done(function(){c._trigger("started",b)})},stop:function(b){var c=a(this).data("fileupload");c._transition(a(this).find(".fileupload-buttonbar .progress")).done(function(){a(this).find(".bar").css("width","0%"),c._trigger("stopped",b)})},destroy:function(b,c){var d=a(this).data("fileupload");c.url&&a.ajax(c),d._adjustMaxNumberOfFiles(1),d._transition(c.context).done(function(){a(this).remove(),d._trigger("destroyed",b,c)})}},_enableDragToDesktop:function(){var b=a(this),c=b.prop("href"),d=b.prop("download"),e="application/octet-stream";b.bind("dragstart",function(a){try{a.originalEvent.dataTransfer.setData("DownloadURL",[e,d,c].join(":"))}catch(b){}})},_adjustMaxNumberOfFiles:function(a){typeof this.options.maxNumberOfFiles=="number"&&(this.options.maxNumberOfFiles+=a,this.options.maxNumberOfFiles<1?this._disableFileInputButton():this._enableFileInputButton())},_formatFileSize:function(a){return typeof a!="number"?"":a>=1e9?(a/1e9).toFixed(2)+" GB":a>=1e6?(a/1e6).toFixed(2)+" MB":(a/1e3).toFixed(2)+" KB"},_hasError:function(a){return a.error?a.error:this.options.maxNumberOfFiles<0?"maxNumberOfFiles":!this.options.acceptFileTypes.test(a.type)&&!this.options.acceptFileTypes.test(a.name)?"acceptFileTypes":this.options.maxFileSize&&a.size>this.options.maxFileSize?"maxFileSize":typeof a.size=="number"&&a.size<this.options.minFileSize?"minFileSize":null},_validate:function(b){var c=this,d=!!b.length;return a.each(b,function(a,b){b.error=c._hasError(b),b.error&&(d=!1)}),d},_renderTemplate:function(b,c){if(!b)return a();var d=b({files:c,formatFileSize:this._formatFileSize,options:this.options});return d instanceof a?d:a(this.options.templatesContainer).html(d).children()},_renderPreview:function(b,d){var e=this,f=this.options,g=a.Deferred();return(c&&c(b,function(a){d.append(a),e._forceReflow(d),e._transition(d).done(function(){g.resolveWith(d)})},{maxWidth:f.previewMaxWidth,maxHeight:f.previewMaxHeight,canvas:f.previewAsCanvas})||g.resolveWith(d))&&g},_renderPreviews:function(b,c){var d=this,e=this.options;return c.find(".preview span").each(function(c,f){var g=b[c];e.previewSourceFileTypes.test(g.type)&&(a.type(e.previewSourceMaxFileSize)!=="number"||g.size<e.previewSourceMaxFileSize)&&(d._processingQueue=d._processingQueue.pipe(function(){var b=a.Deferred();return d._renderPreview(g,a(f)).done(function(){b.resolveWith(d)}),b.promise()}))}),this._processingQueue},_renderUpload:function(a){return this._renderTemplate(this.options.uploadTemplate,a)},_renderDownload:function(a){return this._renderTemplate(this.options.downloadTemplate,a).find("a[download]").each(this._enableDragToDesktop).end()},_startHandler:function(b){b.preventDefault();var c=a(this),d=c.closest(".template-upload"),e=d.data("data");e&&e.submit&&!e.jqXHR&&e.submit()&&c.prop("disabled",!0)},_cancelHandler:function(b){b.preventDefault();var c=a(this).closest(".template-upload"),d=c.data("data")||{};d.jqXHR?d.jqXHR.abort():(d.errorThrown="abort",b.data.fileupload._trigger("fail",b,d))},_deleteHandler:function(b){b.preventDefault();var c=a(this);b.data.fileupload._trigger("destroy",b,{context:c.closest(".template-download"),url:c.attr("data-url"),type:c.attr("data-type")||"DELETE",content:c.attr("data-content"),dataType:b.data.fileupload.options.dataType})},_forceReflow:function(b){this._reflow=a.support.transition&&b.length&&b[0].offsetWidth},_transition:function(b){var c=this,d=a.Deferred();return a.support.transition&&b.hasClass("fade")?b.bind(a.support.transition.end,function(c){c.target===b[0]&&(b.unbind(a.support.transition.end),d.resolveWith(b))}).toggleClass("in"):(b.toggleClass("in"),d.resolveWith(b)),d},_initButtonBarEventHandlers:function(){var b=this.element.find(".fileupload-buttonbar"),c=this.options.filesContainer,d=this.options.namespace;b.find(".start").bind("click."+d,function(a){a.preventDefault(),c.find(".start button").click()}),b.find(".cancel").bind("click."+d,function(a){a.preventDefault(),c.find(".cancel button").click()}),b.find(".delete").bind("click."+d,function(a){a.preventDefault(),c.find(".delete input:checked").siblings("button").click(),b.find(".toggle").prop("checked",!1)}),b.find(".toggle").bind("change."+d,function(b){c.find(".delete input").prop("checked",a(this).is(":checked"))})},_destroyButtonBarEventHandlers:function(){this.element.find(".fileupload-buttonbar button").unbind("click."+this.options.namespace),this.element.find(".fileupload-buttonbar .toggle").unbind("change."+this.options.namespace)},_initEventHandlers:function(){d.prototype._initEventHandlers.call(this);var a={fileupload:this};this.options.filesContainer.delegate(".start button","click."+this.options.namespace,a,this._startHandler).delegate(".cancel button","click."+this.options.namespace,a,this._cancelHandler).delegate(".delete button","click."+this.options.namespace,a,this._deleteHandler),this._initButtonBarEventHandlers()},_destroyEventHandlers:function(){var a=this.options;this._destroyButtonBarEventHandlers(),a.filesContainer.undelegate(".start button","click."+a.namespace).undelegate(".cancel button","click."+a.namespace).undelegate(".delete button","click."+a.namespace),d.prototype._destroyEventHandlers.call(this)},_enableFileInputButton:function(){this.element.find(".fileinput-button input").prop("disabled",!1).parent().removeClass("disabled")},_disableFileInputButton:function(){this.element.find(".fileinput-button input").prop("disabled",!0).parent().addClass("disabled")},_initTemplates:function(){var a=this.options;a.templatesContainer=document.createElement(a.filesContainer.prop("nodeName")),b&&(a.uploadTemplateId&&(a.uploadTemplate=b(a.uploadTemplateId)),a.downloadTemplateId&&(a.downloadTemplate=b(a.downloadTemplateId)))},_initFilesContainer:function(){var b=this.options;b.filesContainer===undefined?b.filesContainer=this.element.find(".files"):b.filesContainer instanceof a||(b.filesContainer=a(b.filesContainer))},_initSpecialOptions:function(){d.prototype._initSpecialOptions.call(this),this._initFilesContainer(),this._initTemplates()},_create:function(){d.prototype._create.call(this),this._refreshOptionsList.push("filesContainer","uploadTemplateId","downloadTemplateId"),a.blueimpIP||(this._processingQueue=a.Deferred().resolveWith(this).promise(),this.resize=function(){return this._processingQueue})},enable:function(){d.prototype.enable.call(this),this.element.find("input, button").prop("disabled",!1),this._enableFileInputButton()},disable:function(){this.element.find("input, button").prop("disabled",!0),this._disableFileInputButton(),d.prototype.disable.call(this)}})})
  69. ;window.locale={fileupload:{errors:{maxFileSize:"File is too big",minFileSize:"File is too small",acceptFileTypes:"Filetype not allowed",maxNumberOfFiles:"Max number of files exceeded",uploadedBytes:"Uploaded bytes exceed file size",emptyResult:"Empty file upload result"},error:"Error",start:"Start",cancel:"Cancel",destroy:"Delete"}},$(function(){"use strict",$("#fileupload").fileupload(),$("#fileupload").fileupload("option",{maxFileSize:5e8,resizeMaxWidth:1400,resizeMaxHeight:900})})
  70. ;function setupAlbumUpload(a){var b=null;totalCount=0,$(".fileupload-album").each(function(){var a=500,b=0,c=0,d=0,e=this;currentAlbumID>0?$.getJSON("/WebServices/UploadHandler.ashx?t="+(new Date).getTime()+"&album="+currentAlbumID,function(a){a&&a.length?($(e).fileupload("option","done").call(e,null,{result:a}),totalDoneCount=a.length,totalCount=a.length,totalDoneCount<=0?($(".review-toolbar .progress").first().removeClass("in"),$(".upload-images").first().removeClass("upload-hasfiles")):$(".upload-images").first().addClass("upload-hasfiles")):($(".review-toolbar .progress").first().removeClass("in"),$(".upload-images").first().removeClass("upload-hasfiles"))}):($(".review-toolbar .progress").first().removeClass("in"),$(".upload-images").first().removeClass("upload-hasfiles")),$(this).fileupload({maxFileSize:1012e4,maxChunkSize:1e8,sequentialUploads:!1,limitConcurrentUploads:2,autoUpload:!0,currentFileNames:[],currentDoneFileNames:[],previewMaxWidth:190,filesContainer:$("#files"),previewMaxHeight:190,acceptFileTypes:/(png)|(jpe?g)|(gif)$/i,locale:{"File is too big":"Dung lượng giới hạn 10M","Filetype not allowed":"Chỉ upload hình ảnh","Max number exceeded":"Giới hạn 100 hình"},progressall:function(a,b){$(".review-toolbar .progress").first().addClass("in"),$(".review-toolbar .progress .bar").css("width",Math.round(b.loaded/b.total*100)+"%"),$(".review-toolbar .progress .progress-text").html(Math.round(b.loaded/b.total*100)+"%")},add:function(b,e){var f=$(this).data("fileupload"),g=f.options,h=e.files;c++,totalCount++,d++;var i=[];$.each(h,function(a,b){var c=!1;$.each(g.currentFileNames,function(a,d){b.name==d&&(c=!0)}),c==0&&(i.push(b),g.currentFileNames.push(b.name))});if(i.length>0){if(!f._validate(e.files))return alert(CommonText.InvalidUploadFile),!1;if(totalCount>=a)return alert("Số lượng hình ảnh vượt quá giới hạn ["+a+"] hình."),!1;f._adjustMaxNumberOfFiles(-h.length),e.isAdjusted=!0,totalCount>0&&$(this).find(".upload-images").first().addClass("upload-hasfiles"),$(this).fileupload("resize",e).done(e,function(){e.files.valid=e.isValidated=f._validate(h),e.context=f._renderUpload(h).appendTo(g.filesContainer).data("data",e),f._renderPreviews(h,e.context),f._forceReflow(e.context),f._transition(e.context).done(function(){f._trigger("added",b,e)!==!1&&(g.autoUpload||e.autoUpload)&&e.autoUpload!==!1&&e.isValidated&&e.submit()})})}AutoResizePopup()},done:function(a,b){c--,totalDoneCount++;var e=$(this).data("fileupload"),f=e.options,g,h;b.context?b.context.each(function(c){var h=$.isArray(b.result)&&b.result[c]||{error:"emptyResult"};h.error&&e._adjustMaxNumberOfFiles(1),e._transition($(this)).done(function(){var c=$(this);g=e._renderDownload([h]).replaceAll(c),e._forceReflow(g),e._transition(g).done(function(){b.context=$(this),e._trigger("completed",a,b),d<=0?($(".review-toolbar .progress").first().addClass("in"),$(".review-toolbar .progress .bar").css("width",Math.round(b.loaded/b.total*100)+"%"),$(".review-toolbar .progress .progress-text").html(Math.round(b.loaded/b.total*100)+"%")):d--,!(totalCount<=0),f.currentDoneFileNames.push(h.name)})})}):(g=e._renderDownload(b.result).appendTo(e.options.filesContainer),e._forceReflow(g),e._transition(g).done(function(){b.context=$(this),e._trigger("completed",a,b)})),$(this).find(".name.watermark-text").watermark(write_review_upload_photo_watermark,{className:"reviewform-errorText",useNative:!1}),AutoResizePopup();if(d==0){inUploadProcessing=!1;var i=100;$(".progress .bar").css({width:i+"%"}),$(".progress .progress-text").html(i+"%")}},fail:function(a,b){totalCount--,d>0&&d--;var c=$(this).data("fileupload"),e=c.options,f=b.files,g;c._adjustMaxNumberOfFiles(b.files.length);if(totalDoneCount<=0||totalCount<=0)$(".review-toolbar .progress").first().removeClass("in"),$(".upload-images").first().removeClass("upload-hasfiles");b.context?b.context.each(function(d){$.each(f,function(a,c){(c=b.files[d].name)&&e.currentFileNames.splice(a,1)});if(b.errorThrown!=="abort"){var h=b.files[d];h.error=h.error||b.errorThrown||!0,c._transition($(this)).done(function(){var d=$(this);g=c._renderDownload([h]).replaceAll(d),c._forceReflow(g),c._transition(g).done(function(){b.context=$(this),c._trigger("failed",a,b)})})}else c._transition($(this)).done(function(){$(this).remove(),c._trigger("failed",a,b)})}):b.errorThrown!=="abort"?(c._adjustMaxNumberOfFiles(-b.files.length),b.context=c._renderUpload(b.files).appendTo(c.options.filesContainer).data("data",b),c._forceReflow(b.context),c._transition(b.context).done(function(){b.context=$(this),c._trigger("failed",a,b)})):c._trigger("failed",a,b),AutoResizePopup()},destroy:function(a,b){var c=$(this).data("fileupload"),d=c.options;b.url&&$.ajax(b),totalDoneCount--,totalCount--,c._adjustMaxNumberOfFiles(1),c._transition(b.context).done(function(){$(this).remove();if(totalDoneCount<=0||totalCount<=0)$(".review-toolbar .progress").first().removeClass("in"),$(".upload-images").first().removeClass("upload-hasfiles");$.each(d.currentDoneFileNames,function(a,c){b.content==c&&(d.currentDoneFileNames.splice(a,1),d.currentFileNames.splice(a,1))}),c._trigger("destroyed",a,b)}),AutoResizePopup()}})})}var totalCount=0,totalDoneCount=0
  71. ;function readCookie(a){var b=a+"=",c=document.cookie.split(";");for(var d=0;d<c.length;d++){var e=c[d];while(e.charAt(0)==" ")e=e.substring(1,e.length);if(e.indexOf(b)==0)return e.substring(b.length,e.length)}return null}function setupReviewUpload(){var a=null;totalCount=0,$(".fileupload-review").each(function(){var a=500,b=0,c=0,d=0,e=this;currentReviewID>0?$.getJSON("/WebServices/UploadHandler.ashx?t="+(new Date).getTime()+"&c="+currentReviewID,function(a){a&&a.length?($(e).fileupload("option","done").call(e,null,{result:a}),totalDoneCount=a.length,totalCount=a.length,totalDoneCount<=0?($(".review-toolbar .progress").first().removeClass("in"),$(".upload-images").first().removeClass("upload-hasfiles")):$(".upload-images").first().addClass("upload-hasfiles")):($(".review-toolbar .progress").first().removeClass("in"),$(".upload-images").first().removeClass("upload-hasfiles"))}):($(".review-toolbar .progress").first().removeClass("in"),$(".upload-images").first().removeClass("upload-hasfiles")),$(this).fileupload({maxFileSize:1012e4,maxChunkSize:1e8,sequentialUploads:!1,limitConcurrentUploads:2,autoUpload:!0,currentFileNames:[],currentDoneFileNames:[],previewMaxWidth:190,filesContainer:$("#files"),previewMaxHeight:190,acceptFileTypes:/(png)|(jpe?g)|(gif)$/i,locale:{"File is too big":"Dung lượng giá»›i hạn 10M","Filetype not allowed":"Chỉ upload hình ảnh","Max number exceeded":"Giá»›i hạn 100 hình"},progressall:function(a,b){inUploadProcessing=!0,$(".review-toolbar .progress").first().addClass("in"),$(".review-toolbar .progress .bar").css("width",Math.round(b.loaded/b.total*100)+"%"),$(".review-toolbar .progress .progress-text").html(Math.round(b.loaded/b.total*100)+"%"),Math.round(b.loaded/b.total*100)==100&&(inUploadProcessing=!1)},add:function(b,e){var f=$(this).data("fileupload"),g=f.options,h=e.files;c++,totalCount++,d++;var i=[];$.each(h,function(a,b){var c=!1;$.each(g.currentFileNames,function(a,d){b.name==d&&(c=!0)}),c==0&&(i.push(b),g.currentFileNames.push(b.name))});if(i.length>0){if(!f._validate(e.files))return alert(CommonText.InvalidUploadFile),!1;if(totalCount>=a)return alert("Số lượng hình ảnh vượt quá giá»›i hạn ["+a+"] hình."),!1;f._adjustMaxNumberOfFiles(-h.length),e.isAdjusted=!0,totalCount>0&&$(this).find(".upload-images").first().addClass("upload-hasfiles"),$(this).fileupload("resize",e).done(e,function(){e.files.valid=e.isValidated=f._validate(h),e.context=f._renderUpload(h).appendTo(g.filesContainer).data("data",e),f._renderPreviews(h,e.context),f._forceReflow(e.context),f._transition(e.context).done(function(){f._trigger("added",b,e)!==!1&&(g.autoUpload||e.autoUpload)&&e.autoUpload!==!1&&e.isValidated&&e.submit()})})}AutoResizePopup()},done:function(a,b){c--,totalDoneCount++;var e=$(this).data("fileupload"),f=e.options,g,h;b.context?b.context.each(function(c){var h=$.isArray(b.result)&&b.result[c]||{error:"emptyResult"};h.error&&e._adjustMaxNumberOfFiles(1),e._transition($(this)).done(function(){var c=$(this);g=e._renderDownload([h]).replaceAll(c),e._forceReflow(g),e._transition(g).done(function(){b.context=$(this),e._trigger("completed",a,b),d<=0?($(".review-toolbar .progress").first().addClass("in"),$(".review-toolbar .progress .bar").css("width",Math.round(b.loaded/b.total*100)+"%"),$(".review-toolbar .progress .progress-text").html(Math.round(b.loaded/b.total*100)+"%")):d--,!(totalCount<=0),f.currentDoneFileNames.push(h.name)})})}):(g=e._renderDownload(b.result).appendTo(e.options.filesContainer),e._forceReflow(g),e._transition(g).done(function(){b.context=$(this),e._trigger("completed",a,b)})),$(this).find(".name.watermark-text").watermark(write_review_upload_photo_watermark,{className:"reviewform-errorText",useNative:!1}),AutoResizePopup(),totalCount==totalDoneCount&&UploadReview.AutoSavePictureChange();if(d==0){inUploadProcessing=!1;var i=100;$(".progress .bar").css({width:i+"%"}),$(".progress .progress-text").html(i+"%")}},fail:function(a,b){totalCount--,d>0&&d--;var c=$(this).data("fileupload"),e=c.options,f=b.files,g;c._adjustMaxNumberOfFiles(b.files.length);if(totalDoneCount<=0||totalCount<=0)totalDoneCount<=0&&$(".review-toolbar .progress").first().removeClass("in"),totalCount<=0&&$(".upload-images").first().removeClass("upload-hasfiles");b.context?b.context.each(function(d){$.each(f,function(a,c){(c=b.files[d].name)&&e.currentFileNames.splice(a,1)});if(b.errorThrown!=="abort"){var h=b.files[d];h.error=h.error||b.errorThrown||!0,c._transition($(this)).done(function(){var d=$(this);g=c._renderDownload([h]).replaceAll(d),c._forceReflow(g),c._transition(g).done(function(){b.context=$(this),c._trigger("failed",a,b)})})}else c._transition($(this)).done(function(){$(this).remove(),c._trigger("failed",a,b)})}):b.errorThrown!=="abort"?(c._adjustMaxNumberOfFiles(-b.files.length),b.context=c._renderUpload(b.files).appendTo(c.options.filesContainer).data("data",b),c._forceReflow(b.context),c._transition(b.context).done(function(){b.context=$(this),c._trigger("failed",a,b)})):c._trigger("failed",a,b),AutoResizePopup()},destroy:function(a,b){var c=$(this).data("fileupload"),d=c.options;isModifiedMode||b.url&&$.ajax(b),totalDoneCount--,totalCount--,c._adjustMaxNumberOfFiles(1),c._transition(b.context).done(function(){$(this).remove(),totalDoneCount<=0&&$(".review-toolbar .progress").first().removeClass("in"),totalCount<=0&&$(".upload-images").first().removeClass("upload-hasfiles"),$.each(d.currentDoneFileNames,function(a,c){b.content==c&&(d.currentDoneFileNames.splice(a,1),d.currentFileNames.splice(a,1))}),c._trigger("destroyed",a,b)}),AutoResizePopup(),UploadReview.AutoSavePictureChange()}})})}var totalCount=0,totalDoneCount=0,inUploadProcessing=!1;$(function(){window.onbeforeunload=function(){if(inUploadProcessing)return"Bạn Ä‘ang viết review cho nhà  hà ng nà y. Thông tin sẽ không được lÆ°u lại nếu tắt nữa chừng"},$.ajaxSetup({beforeSend:function(a){a.setRequestHeader("X-Foody-User-Token",readCookie("FOODY.RequestVerificationToken"))}})})
  72. ;function saveDraftReview(a){var b="";$("#txtReviewContent").mentionsInput("getMentions",function(a){var c=[];for(var d=0;d<a.length;d++)c.push({Id:a[d].id,Name:a[d].value});b=JSON.stringify(c)});var c=$("#txtReviewContent").data("messageText");if(!c||c.length==0)c=$("#txtReviewContent").val();var d={Title:$("#txtReviewTitle").val(),ReviewContent:c,PositionPoint:clickedOnRating?$("#hdpositionPoint").val():null,PricePoint:clickedOnRating?$("#hdpricePoint").val():null,FoodPoint:clickedOnRating?$("#hdfoodPoint").val():null,ServicePoint:clickedOnRating?$("#hdservicePoint").val():null,AtmospherePoint:clickedOnRating?$("#hdatmospherePoint").val():null,DishesChosen:$("#hdDishesChosen").val(),Guest:$("#hdGuest").val(),MoneySpend:$("#hdMoneySpend").val(),VisitAgain:$("#hdVisitAgain").val(),RestaurantId:$("#hdRestaurantId").val(),RestaurantName:$("#hdRestaurantName").val(),YoutubeCode:$("#YoutubeCode").val(),hashtagsString:b,IsPrivateFeedback:$("#hdprivateFeedback").val()};$("#review-auto-save").css("display","block"),$.post("/Review/SaveReviewAsDraft",d,function(b){if(b.Success){$("#review-auto-save").css("display","none");if(currentReviewID=="undefined"||currentReviewID==null||currentReviewID==0)currentReviewID=b.ReviewId,UploadReview.AutoSavePictureChange();currentReviewID=b.ReviewId,typeof a!="undefined"&&a!=null&&a()}})}function clickedForRating(){return clickedOnRating?($("#ratingError").text(""),$("#review-not-rating-div").hide()):($("#ratingError").text(ReviewText.RequiredPointMsg),$("#review-not-rating-div").show()),clickedOnRating}function doneTyping(){saveDraftReview()}function donePictureAction(){UploadReview.SavePictureAsDraft(currentReviewID,tokenUploadKey)}function bindSlider(a,b,c){var d=$(c).val();d==null||d==""?d=6:clickedOnRating=!0,$(a).slider({range:"min",value:d,min:1,max:10,slide:function(a,d){$(b).text(d.value),$(c).val(d.value)},change:function(a,b){clickedOnRating=!0,$("#ratingError").css("display","none"),$("#review-not-rating-div").hide();var c=getAveragePoints();$("#ratingAverage").text("("+c+")"),$("#ratingAverageText").text(getPointsAppropriateText(c));var d=getPointsAppropriateColor(c);$("#ratingAverage").css("color",d),$("#ratingAverageText").css("color",d),UploadReview.AutoSaveSliderChange()}}),$(b).text($(a).slider("value")),$(c).val($(a).slider("value"))}function ddlOptionChange(a,b){var c=$(a).val();$(b).val(c)}function getAveragePoints(){var a=0,b=parseInt($("#hdpositionPoint").val()),c=parseInt($("#hdpricePoint").val()),d=parseInt($("#hdfoodPoint").val()),e=parseInt($("#hdservicePoint").val()),f=parseInt($("#hdatmospherePoint").val());return a=(b+c+d+e+f)/5,parseFloat(a).toFixed(1)}function getPointsAppropriateText(a){var b="";return a<5?b=CommonText.MicrositeRatingBad:a<7?b=CommonText.MicrositeRatingAverage:a<9?b=CommonText.MicrositeRatingGood:b=CommonText.MicrositeRatingExcellent,b}function getPointsAppropriateColor(a){var b="";return a<5?b="#cc0000":a<7?b="#000":b="#03ae03",b}function validInput(){var a=!0;$.trim($("#txtReviewTitle").val())==""&&$.watermark.show("#txtReviewTitle");var b=!0;return $.trim($("#txtReviewContent").val())==""?(b=!1,$.watermark.show("#txtReviewContent"),$("#error-ReviewContent").css("display","inline")):b=!0,clickedForRating()&&a&&b}function showLoadingProcess(){$("#addNewReviewLoadingImg").css("display","block")}function hideLoadingProcess(){$("#addNewReviewLoadingImg").css("display","none")}function word_count(a){var b=0,c=$(a).val().match(/\b/g);c&&(b=c.length/2);if(b>0){var d=reviewLength/totalSteps,e=100/totalSteps,f=b%d;if(f>0){var g=(b-f)/d;if(g<=totalSteps){var h=e*g;$(".typeometer-bar").css("width",h+"%"),$(".typeometer-right").text(b-f+"+")}else $(".typeometer-bar").css("width","100%"),$(".typeometer-right").text(reviewLength+"+")}}else $(".typeometer-bar").css("width","0%"),$(".typeometer-right").text("")}function killAutoSave(){typeof typingTimer!="undefined"&&clearTimeout(typingTimer),typeof photoActionTimer!="undefined"&&clearTimeout(photoActionTimer)}function youtube_parser(a){var b=/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/,c=/([^#\&\?]*){11}/,d=a.match(b),e=a.match(c);return d!=null&&d&&d[7].length==11?d[7]:e!=null&&e[0].length==11?a:!1}var clickedOnRating=!1,isModifiedMode=!1,reviewLength=300,totalSteps=20,UploadReview=function(){};UploadReview.Init=function(a){BindingSuggestReviewTitle(),bindSlider("#positionPointSlider","#positionPoint","#hdpositionPoint"),bindSlider("#pricePointSlider","#pricePoint","#hdpricePoint"),bindSlider("#foodPointSlider","#foodPoint","#hdfoodPoint"),bindSlider("#servicePointSlider","#servicePoint","#hdservicePoint"),bindSlider("#atmospherePointSlider","#atmospherePoint","#hdatmospherePoint"),$("#ddlGuest").change(function(){ddlOptionChange(this,"#hdGuest")}),$("#ddlMoneySpend").change(function(){ddlOptionChange(this,"#hdMoneySpend")}),$("#ddlVisitAgain").change(function(){ddlOptionChange(this,"#hdVisitAgain")}),$("#txtReviewTitle").watermark(ReviewText.TitleWatermark,{className:"reviewform-errorText",useNative:!1}),$("#txtReviewContent").watermark(ReviewText.ContentWatermark,{className:"reviewform-errorText",useNative:!1}),$("#YoutubeCode").watermark("Chèn code link video từ Youtube, ví dụ: d1G23B8giN0",{className:"reviewform-errorText",useNative:!1}),$("#txtReviewContent").blur(function(){$.trim($(this).val())==""?$("#error-ReviewContent").css("display","inline"):$("#error-ReviewContent").css("display","none")}),$("#ddlGuest").val($("#hdGuest").val()),$("#ddlMoneySpend").val($("#hdMoneySpend").val()),$("#ddlVisitAgain").val($("#hdVisitAgain").val()),word_count("#txtReviewContent"),$("#txtReviewContent").keyup(function(){word_count("#txtReviewContent")}),a?(UploadReview.AutoSaveTextboxChange("#txtReviewContent"),UploadReview.AutoSaveTextboxChange("#txtReviewTitle"),UploadReview.AutoSaveOptionChange("#ddlGuest"),UploadReview.AutoSaveOptionChange("#ddlMoneySpend"),UploadReview.AutoSaveOptionChange("#ddlVisitAgain"),UploadReview.AutoSaveOptionChange("#YoutubeCode"),UploadReview.AutoSaveOptionChange("#hdprivateFeedback"),UploadReview.IsAutoSave=!0):UploadReview.IsAutoSave=!1,$("#YoutubeCode").change(function(){var a=youtube_parser($("#YoutubeCode").val());a!=0&&a!=""?$("#YoutubeCode").val(a):$("#YoutubeCode").val("")})};var bindedErrorWaterMark=!1,tokenUploadKey=null;UploadReview.SavePictureAsDraft=function(a,b){a==null||a==0?saveDraftReview(function(){a!=null&&a!=0&&b!=null&&b!=""&&($("#review-auto-save").show(),$.post("/Upload/SavePicturesAsDraft",{reviewId:a,tokenKey:b},function(a){$("#review-auto-save").hide()}))}):a!=null&&a!=0&&b!=null&&b!=""&&($("#review-auto-save").show(),$.post("/Upload/SavePicturesAsDraft",{reviewId:a,tokenKey:b},function(a){$("#review-auto-save").hide()}))};var typingTimer,photoActionTimer,doneTypingInterval=2e3,donePhotoActionInterval=1e3;UploadReview.AutoSaveTextboxChange=function(a){$(a).change(function(){clearTimeout(typingTimer),a&&(typingTimer=setTimeout(doneTyping,doneTypingInterval))}),$(a).keyup(function(){clearTimeout(typingTimer),a&&(typingTimer=setTimeout(doneTyping,doneTypingInterval))})},UploadReview.IsAutoSave=!1,UploadReview.AutoSaveSliderChange=function(){UploadReview.IsAutoSave&&(clearTimeout(typingTimer),typingTimer=setTimeout(doneTyping,doneTypingInterval))},UploadReview.AutoSaveOptionChange=function(a){$(a).change(function(){clearTimeout(typingTimer),typingTimer=setTimeout(doneTyping,doneTypingInterval)})},UploadReview.AutoSavePictureChange=function(){UploadReview.IsAutoSave&&(clearTimeout(photoActionTimer),photoActionTimer=setTimeout(donePictureAction,donePhotoActionInterval))},UploadReview.ShowLoadingDialog=function(){$("#loadingDialog").length==0&&$("body").append('<div id="loadingDialog" style="display:none;"><div style="padding-top:100px; padding-bottom:100px;padding-left:400px;"><img alt="Đang tải ..." src="'+staticPath+'Style/images/loading-review.gif" /></div></div>'),$.modal.close(),$("#loadingDialog").modal()},UploadReview.LoadAddNewReviewForm=function(a,b,c){var d=new Date;UploadReview.ShowLoadingDialog(),clickedOnRating=!1,$.ajax({type:"GET",url:"/Common/IsLogin?"+d.getTime(),success:function(d){d.success==1?UploadReview.OpenWriteReviewForm(a,b,c):LoginPopup.Show(function(){$.modal.close(),UploadReview.OpenWriteReviewForm(a,b,c)},c)}})},UploadReview.LoadModifiedReviewForm=function(a,b,c,d){var e=new Date;$.get("/review/CanEditOrUpdateReview?reviewid="+a+"&t="+e.getTime(),function(e){if(e.Success)UploadReview.ShowLoadingDialog(),UploadReview.OpenEditReviewForm(a,b,c,d);else switch(e.ErrorType){case 3:LoginPopup.Show(function(){$.modal.close(),UploadReview.OpenEditReviewForm(a,b,c,d)});break;case 1:alert(ReviewText.CannotEditIfNotOwner);break;case 2:alert(ReviewText.EditTimeIsOver);break;case 4:alert(ReviewText.CannotEditIfApproved)}}),UploadReview.CurrentRestaurantId=b,UploadReview.UploadReviewSuccessCallback=c},UploadReview.UploadReviewSuccessCallback=null,UploadReview.CurrentRestaurantId=0,UploadReview.OpenWriteReviewForm=function(a,b,c){$.modal.close();var d=new Date,e="/Review/OpenNewReviewForm?restaurantId="+a+"&t="+d.getTime();$("#reviewDialog").length==0&&$("body").append('<div id="reviewDialog" style="display: none"></div>'),$("#reviewDialog").html('<div style="padding-top:100px; padding-bottom:100px;padding-left:400px;"><img alt="Đang tải ..." src="'+staticPath+'Style/images/loading-review.gif" /></div>').modal({onClose:function(a){inUploadProcessing?confirm("Ảnh đang được tải lên, bạn có muốn dừng ngay!")&&(inUploadProcessing=!1,killAutoSave(),$.modal.close(),typeof c!="undefined"&&c!=null&&c()):(killAutoSave(),$.modal.close(),typeof c!="undefined"&&c!=null&&c())}}),$("#reviewDialog").load(e,function(){setupReviewUpload()}).modal({onClose:function(a){inUploadProcessing?confirm("Ảnh đang được tải lên, bạn có muốn dừng ngay!")&&(inUploadProcessing=!1,killAutoSave(),$.modal.close(),typeof c!="undefined"&&c!=null&&c()):(killAutoSave(),$.modal.close(),typeof c!="undefined"&&c!=null&&c())}}),UploadReview.CurrentRestaurantId=a,UploadReview.UploadReviewSuccessCallback=b},UploadReview.OpenEditReviewForm=function(a,b,c,d){isModifiedMode=!0,$.modal.close();var e=new Date,f="/Review/OpenNewReviewForm?restaurantId="+b+"&modifiedReviewId="+a+"&t="+e.getTime();$("#reviewDialog").length==0&&$("body").append('<div id="reviewDialog" style="display: none"></div>'),$("#reviewDialog").html('<div style="padding-top:100px; padding-bottom:100px;padding-left:400px;"><img alt="Đang tải ..." src="'+staticPath+'Style/images/loading-review.gif" /></div>').modal({onClose:function(a){inUploadProcessing||(killAutoSave(),$.modal.close(),typeof d!="undefined"&&d!=null&&d())}}),$("#reviewDialog").load(f,function(){setupReviewUpload()}).modal({onClose:function(a){inUploadProcessing||(killAutoSave(),typeof d!="undefined"&&d!=null&&d(),$.modal.close())}}),UploadReview.CurrentRestaurantId=b,UploadReview.UploadReviewSuccessCallback=c},UploadReview.PostReview=function(a){if(validInput())if(!inUploadProcessing){killAutoSave(),showLoadingProcess();var b="";$("#txtReviewContent").mentionsInput("getMentions",function(a){var c=[];for(var d=0;d<a.length;d++)c.push({Id:a[d].id,Name:a[d].value});b=JSON.stringify(c)});var c=$("#txtReviewContent").data("messageText");if(!c||c.length==0)c=$("#txtReviewContent").val();var d={ReviewId:$("#ReviewId").val(),IsModified:$("#IsModified").val(),Title:$("#txtReviewTitle").val(),ReviewContent:c,PositionPoint:clickedOnRating?$("#hdpositionPoint").val():null,PricePoint:clickedOnRating?$("#hdpricePoint").val():null,FoodPoint:clickedOnRating?$("#hdfoodPoint").val():null,ServicePoint:clickedOnRating?$("#hdservicePoint").val():null,AtmospherePoint:clickedOnRating?$("#hdatmospherePoint").val():null,DishesChosen:$("#hdDishesChosen").val(),Guest:$("#hdGuest").val(),MoneySpend:$("#hdMoneySpend").val(),VisitAgain:$("#hdVisitAgain").val(),RestaurantId:$("#hdRestaurantId").val(),RestaurantName:$("#hdRestaurantName").val(),YoutubeCode:$("#YoutubeCode").val(),hashtagsString:b,HasShareOnFacebook:$("#hdhasShareOnFacebook").val(),ShareOnFacebook:$("#hdshareOnFacebook").val(),IsPrivateFeedback:$("#hdprivateFeedback").val()};$("#btnSubmit").attr("disabled","disabled");var e="/Review/AddNewReview";$.ajax({url:e,type:"POST",data:d,success:function(a){if(a.Success==1){currentReviewID=a.ReviewId;if(typeof UploadReview.UploadReviewSuccessCallback=="undefined"||UploadReview.UploadReviewSuccessCallback==null)totalDoneCount>=0?AttachImg(a.ReviewId,isModifiedMode):(isModifiedMode?GetModifiedReview(a.ReviewId):GetNewReview(a.ReviewId),LoadReviewSummaryBox(UploadReview.CurrentRestaurantId));else{var b="",c=!1;isModifiedMode&&(b=getUploadPictureIds(),c=!0),$.post("/Upload/SaveReviewPictures",{reviewId:currentReviewID,restaurantId:UploadReview.CurrentRestaurantId,type:"other",tokenKey:tokenUploadKey,realPictureIds:b,editMode:c},function(){typeof widgetPostReviewSuccess=="function"&&widgetPostReviewSuccess(a),$.modal.close(),UploadReview.UploadReviewSuccessCallback(currentReviewID)})}}else $.each(a.ErrorList,function(a,b){$("#error-"+b.PropertyName).text(b.ErrorMessage)})},failure:function(a){alert(a)}})}else alert("Ảnh đang được tải vui lòng chờ!");return!1},UploadReview.LoadSuggestRestaurantForReview=function(a,b){var c=new Date;UploadReview.ShowLoadingDialog(),$.ajax({type:"GET",url:"/Common/IsLogin?"+c.getTime(),success:function(c){c.success==1?UploadReview.OpenSuggestRestaurantForm(a,b):LoginPopup.Show(function(){$.modal.close(),UploadReview.OpenSuggestRestaurantForm(a,b)},b)}})},UploadReview.OpenSuggestRestaurantForm=function(a,b){$.modal.close(),$("#suggest-restaurant-reviews-popup").modal({persist:!0}),UploadReview.SuggestedRestaurant==null?(UploadReview.SuggestedRestaurant=new SuggestedRestaurantModel(null),ko.applyBindings(UploadReview.SuggestedRestaurant,document.getElementById("selected-restaurant-to-review"))):(UploadReview.SuggestedRestaurant.data(null),UploadReview.SuggestedRestaurant.searchText(""),$("#txtResSearch").val(""))},UploadReview.SuggestedRestaurant=null;var SuggestedRestaurantModel=function(a){var b=this;b.data=ko.observable(a),b.searchText=ko.observable(""),b.loading=ko.observable(!1),b.writereview=function(){b.data()!=null&&UploadReview.LoadAddNewReviewForm(b.data().Id,function(a){$.modal.close(),window.location.href=b.data().Url+"/binh-luan-"+a},function(){UploadReview.LoadSuggestRestaurantForReview()})}};UploadReview.GetSuggestedRestaurant=function(a){if(!UploadReview.SuggestedRestaurant.loading()){UploadReview.SuggestedRestaurant.loading(!0);var b=new Date;$.get("/restaurant/GetBasicInfo?t="+b.getTime()+"&restaurantid="+a,function(a){a.success&&UploadReview.SuggestedRestaurant.data(a.data),UploadReview.SuggestedRestaurant.loading(!1)})}},$(".add-new-reviews").live("click",function(){UploadReview.LoadSuggestRestaurantForReview()}),$(function(){$("#txtResSearch").length>0&&($("#txtResSearch").autocomplete({delay:500,source:function(a,b){$.ajax({url:"/directory/suggestlist?limit=100&provinceId="+currentlocationid,dataType:"json",contentType:"application/json",type:"GET",data:{keyword:""+a.term+""},success:function(a){var c=a;b($.map(c,function(a){return{label:a.Name,value:a.Id,address:a.Address+", "+a.City,picturePath:a.PicturePath}}))}})},minLength:2,focus:function(a,b){return $(this).val(b.item.label),!1},select:function(a,b){return $(this).val(b.item.label),UploadReview.GetSuggestedRestaurant(b.item.value),!1},open:function(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top")},close:function(){$(this).removeClass("ui-corner-top").addClass("ui-corner-all")}}).data("autocomplete")._renderItem=function(a,b){return $("<li class='lists-items'>").data("item.autocomplete",b).append('<a style="overflow:hidden;" class="lists-items-link"><img style="margin:2px;" align="left" src="'+b.picturePath+'" width="40px" />'+'<span style="display:block; float:left;margin-left:5px;width:460px;">'+b.label+'<br/><span class="lists-items-address" style="font-weight:normal;">'+b.address+"</span></span></a>").appendTo(a)})})
  73. ;function htmlEncode(a){return $("<div/>").text(a).html()}function htmlDecode(a){return $("<div/>").html(a).text()}function bindWriteCommentAutoresize(){$(".write_comment").autoresize({minRows:0,buffer:0,animate:!1})}function closeNewReviewPopup(){$.modal.close()}function addCommentWatermark(){$(".write_comment").watermark(ReviewText.CommentWatermark,{className:"comment-watermark",useNative:!1})}function bindReviewRatingToolTip(){$(".review-point a").each(function(){$(this).attr("tooltip")!="none"&&addRatingTooltip(this)}),$(".review-point-features a").each(function(){$(this).attr("tooltip")!="none"&&addRatingTooltip(this)})}function addRatingTooltip(a){if($(a).attr("tooltip")!="none"){var b=$(a).attr("tooltip");$("#"+b).length==0&&$("body").append('<div id="'+b+'" style="display:none" class="ratingtooltip"></div>'),$(a).tooltip({tip:"#"+b,position:"bottom center",offset:[6,0],delay:0,tipClass:"ratingtooltip",onBeforeShow:function(c,d){if($("#"+b).children().length==0){var e=$(a).attr("reviewId"),f='<div style="width:220px"><div class="top-arrow">';f+='<img src="'+staticPath+'Style/images/icons/arrow-top.png" alt="" />',f+='</div><img height="16px" src="'+staticPath+'style/images/loading.gif" /></div>',$("#"+b).append(f),populateReviewRatingTooltip(b,e)}}})}}function bindReviewRatingTooltipAjaxLoading(a){$(".review-point a[tooltip=ratingTooltip_"+a+"]").each(function(){addRatingTooltip(this)})}function populateReviewRatingTooltip(a,b){var c=new Date;$.ajax({type:"GET",url:"/Review/GetRatingTooltip?reviewId="+b+"&"+c.getTime(),success:function(b){b.success==1?$("#"+a).html(b.html):alert("error")}})}function bindTooltip(){bindingUserTooltip(),bindReviewRatingToolTip(),bindHelpfulTooltip(),bindHelpfulNameTooltip(),bindEditOrDeleteReviewTooltip(),bindPRQATooltip()}function bindHelpfulTooltipByReviewId(a){addHelpfulTooltip($('.review-helpful-link[tooltip="#helpfulTooltip_'+a+'"]'))}function bindHelpfulTooltip(){$(".review-helpful-link").each(function(){addHelpfulTooltip(this)})}function bindingUserTooltipById(a){$('a.user-link[refId="'+a+'"]').each(function(){addUserTooltip(this)}),$('a.user-link-v[refId="'+a+'"]').each(function(){addVerticalUserTooltip(this)})}function bindingUserTooltip(){$(".user-link").each(function(){addUserTooltip(this)})}function addUserTooltip(a){var b=$(a).height();b=b*-1-12;var c=$(a).attr("tooltip");$("#"+c).length==0&&$("body").append('<div id="'+c+'" style="display:none" class="tooltip"></div>'),$(a).tooltip({tip:"#"+c,position:"bottom right",offset:[b,10],delay:50,onBeforeShow:function(b,d){if($("#"+c).children().length==0){var e='<img height="16px" src="'+staticPath+'style/images/loading.gif" />';$("#"+c).append(e);var f=$(a).attr("refId");populateUserTooltip(c,f)}}})}function addVerticalUserTooltip(a){var b=$(a).width();b*=-1;var c=$(a).attr("tooltip");$("#"+c).length==0&&$("body").append('<div id="'+c+'" style="display:none" class="tooltip"></div>'),$(a).tooltip({tip:"#"+c,position:"bottom right",offset:[10,b],delay:50,onBeforeShow:function(b,d){if($("#"+c).children().length==0){var e='<img height="16px" src="'+staticPath+'style/images/loading.gif" />';$("#"+c).append(e);var f=$(a).attr("refId");populateUserTooltip(c,f,2)}}})}function populateUserTooltip(a,b,c){var d=new Date;c==null&&(c=1),$.ajax({type:"GET",url:"/Account/GetUserTooltip?userId="+b+"&"+d.getTime()+"&type="+c,success:function(b){b.success==1?$("#"+a).html(b.html):alert("error")}})}function populateHelpfulContent(a){var b='<div class="count">'+a.length+ReviewText.MemberLikes+"</div>";for(var c=0;c<a.length;c++){var d=a[c];b+='<div style="float:left; width:35px; margin-bottom:2px;">',b+="<div>",b+='<a href="'+d.UserProfileUrl+'">',b+='<img src="'+d.UserCroppedAvatarUrl+'" width="30px" height="30px" original-title="'+d.UserFirstName+'" class="helpfulUserName"/>',b+="</a>",b+="</div>",b+="</div>"}return b}function addHelpfulTooltip(a){var b=$(a).width();b*=-1,$(a).tooltip({tip:$(a).attr("tooltip"),onBeforeShow:function(b,c){var d=$(a).attr("tooltip");if($(d).is(":empty")){$(d).append('<div style="width:100%; height:6px;position: absolute; bottom: -6px; left: 0px;"></div><div class="arrow"><img src="'+staticPath+'/Style/images/icons/arrow-bottom.png" alt="" /></div><div><img height="16px" src="'+staticPath+'/style/images/loading.gif" /></div>');var e=$(a).attr("reviewId");populateHelpfulTooltip(d,e)}},position:"top right",offset:[-5,b],delay:5})}function showCommentTextBox(a){var b=new Date;$.ajax({type:"GET",url:"/Review/IsLogin?"+b.getTime(),success:function(b){b.success==1?prepareToWriteComment(a,b.avatar,b.currentUserProfileUrl):LoginPopup.Show(function(){closeNewReviewPopup(),prepareToWriteComment(a,b.avatar,b.currentUserProfileUrl)})}})}function prepareToWriteComment(a,b,c){$("#review_comment_id_"+a+" .review-reply-item-avatar img").attr("src",b),$("#review_comment_id_"+a+" .review-reply-item-avatar a").attr("href",c),$("#review_comment_id_"+a).css("display","block");var d=$("#write_comment_"+a).offset().top,e=$(window).height();d>e/2&&(d-=e/2),$("body,html").animate({scrollTop:d},500),$("#write_comment_"+a).focus()}function addComment(a,b){var c=b.keyCode,d=0;d=b.shiftKey;if(c!=13||!!d)return!0;b.preventDefault?b.preventDefault():b.returnValue=!1;if(isSubmittingComment==0){var e=$(a).attr("reviewId"),f=$.trim($(a).val());return f!=""&&(isSubmittingComment=!0,$.ajax({type:"POST",url:"/Review/AddComment",data:{reviewId:e,comment:htmlEncode(f)},success:function(a){a.success&&($("#write_comment_"+e).css("height","15px"),$("#write_comment_"+e).val(""),$("#commentBox_"+e).append(a.html),updateTotalComment(e),$('div[reviewId="'+e+'"] .review-reply-item .user-link').each(function(){addUserTooltip(this)}),bindCommentPostedTime(e),isSubmittingComment=!1,PointNotify.AddedPointNotify(a.TotalPendingPoints))}})),!1}}function updateTotalComment(a){var b="#comment_count_"+a,c=parseInt($(b).text());c++,$(b).text(c)}function addThanks(a){var b=new Date;$(".helpful-wating").show(),$.ajax({type:"GET",url:"/Common/IsLogin?"+b.getTime(),success:function(b){if(b.success==1){var c=$(a).attr("reviewId");prepareForAddThanks(c)}else LoginPopup.Show(function(){var b=$(a).attr("reviewId");closeNewReviewPopup(),prepareForAddThanks(b)},function(){$(".helpful-wating").hide()})}})}function populateHelpfulTooltip(a,b){var c=new Date;$.ajax({type:"GET",url:"/Review/ListHelpfulUsers?reviewId="+b+"&"+c.getTime(),success:function(b){if(b.success==1){if(b.data!=null){var c='<div style="width:100%; height:6px;position: absolute; bottom: -6px; left: 0px;"></div><div class="arrow"><img src="'+staticPath+'/Style/images/icons/arrow-bottom.png" alt="" /></div>';b.data.HelpfulUsers.length>0?c+=populateHelpfulContent(b.data.HelpfulUsers):c+='<div class="count">'+ReviewText.BeTheFirstLike+"</div>",c+='<div class="helpful-wating" style="display: none;">',c+='<img src="'+staticPath+'Style/images/icons/ajax-loader.gif" />',c+="</div> ";var d=$(a).height();$(a).html(c),$(a).height()>d&&$(a).css("top",parseInt($(a).css("top"))-($(a).height()-d)),bindHelpfulNameTooltip()}}else alert("error")}})}function prepareForAddThanks(a){var b=new Date;$.ajax({type:"GET",url:"/Review/AddReviewFavourite?reviewId="+a+"&"+b.getTime(),success:function(b){if(b.success==1){$("#totalThanks_id_"+a).text(b.totalFavourites),$('a.review-helpful-link[reviewId="'+a+'"]').effect("highlight",{},3e3);var c=$('a.review-helpful-link[reviewId="'+a+'"]').attr("tooltip");populateHelpfulTooltip(c,a),PointNotify.AddedPointNotify(b.TotalPendingPoints)}$(".helpful-wating").hide()}})}function showAllComments(a,b){var c="/Review/ListAllCommentsByReview?reviewId="+a;$("#commentBox_"+a).load(c,function(){$("#commentBox_"+a+" .user-link").each(function(){addUserTooltip(this)}),bindCommentPostedTime(a),$(b).closest(".view-all-comments").hide()})}function loadUserTotalReviews(a){var b=$("#userReviews_"+a).attr("userreviews");$('div.status[userreviews="'+b+'"]').text($('div.status[userreviews="'+b+'"]:eq(0)').text())}function IncreaseGlobalTotalReview(a){var b=",";$("#global-total-reviews").text().indexOf(",")==-1&&(b=".");var c=parseInt($("#global-total-reviews").text().replace(b,""))+a;$("#global-total-reviews").text(addCommas(c,b))}function addCommas(a,b){a+="",x=a.split("."),x1=x[0],x2=x.length>1?"."+x[1]:"";var c=/(\d+)(\d{3})/;while(c.test(x1))x1=x1.replace(c,"$1"+b+"$2");return x1+x2}function updateTotalUserReviewsAndPictures(a){var b=$('div.review-item[reviewId="'+a+'"] span[userreviews]').attr("userreviews"),c=$('div.review-item[reviewId="'+a+'"] span[userpictures]').attr("userpictures"),d=$('div.review-item[reviewId="'+a+'"] span[userreviews]').first().text(),e=$('div.review-item[reviewId="'+a+'"] span[userpictures]').first().text();$('div.status[userreviews="'+b+'"]').text(d+" bình luận"),$('span[userreviews="'+b+'"]').text(d),$('span[userpictures="'+c+'"]').text(e)}function updateTotalReviewsAndPicturesByUsername(a,b,c){$('span[userreviews="userReviews_'+a+'"]').text(b),$('span[userpictures="userPictures_'+a+'"]').text(c),$('div.status[userreviews="userReviews_'+a+'"]').text(b+" "+ReviewText.Review)}function bindHelpfulNameTooltip(){$("img.helpfulUserName").tipsy({gravity:"s"})}function RemoveReviewByIndex(a){var b=$(".micro-home-recent-review.review-item");if(b.length>=a&&a>0){var c=b[a-1];$(c).remove()}}function ScrollToReview(a){var b=0,c=$("#review-"+a).children().first();b=$(c).position().top;if(b>0)$("body,html").animate({scrollTop:b},800),$(c).effect("highlight",{},3e3);else var d=setInterval(function(){c=$("#review-"+a).children().first(),b=$(c).position().top,b>0&&(clearInterval(d),$("body,html").animate({scrollTop:b},800),$(c).effect("highlight",{},3e3))},200)}function LoadReviewSummaryBox(a){if($("#reviewSummaryDiv").length>0){$("#reviewSummaryDiv").show();var b=new Date,c="/Review/GetReviewSummary?restaurantId="+a;typeof hasFiltered!="undefined"&&hasFiltered!=null&&hasFiltered&&(c+="&hasFiltered=true"),c+="&"+b.getTime(),$("#reviewSummaryDiv").load(c,function(){$(".res-common-rating-number a").text($(".micro-home-point .micro-home-points").text())}),$.get("/restaurant/GetPointSummary?restaurantid="+a+"&t="+b.getTime(),function(a){a.success&&$("#res-summary-point").html(a.html)})}}function GetModifiedReview(a){if(typeof reviewtemplate=="undefined"||reviewtemplate==null)reviewtemplate=1;var b=new Date,c="";isReviewDetailPage?c="/Review/GetReview?t="+b.getTime()+"&reviewId="+a+"&template="+reviewtemplate:c="/Review/GetReviewById?t="+b.getTime()+"&reviewId="+a+"&template="+reviewtemplate,$.get(c,function(b){var c=!0;isReviewDetailPage?$("#review-"+a).empty().append(b):(c=b.success,c&&(typeof homeReviewsModel!="undefined"&&homeReviewsModel!=null&&homeReviewsModel.replaceReview(b.data),typeof resReviewsModel!="undefined"&&resReviewsModel!=null&&resReviewsModel.replaceReview(b.data))),b.userid!=null&&removeUserTooltip(b.userid),c&&($("#ratingTooltip_"+a).remove(),bindTooltip(),bindPostedTime(a),updateTotalUserReviewsAndPictures(a),addCommentWatermark(),ScrollToReview(a),bindReviewReportByReviewId(a),hideLoadingProcess(),closeNewReviewPopup(),drawChart())})}function UpdateMicrositePictures(a,b){$.post("/Gallery/GetRestaurantStatistic?restaurantId="+a,function(a){var c=a.data;if(c.length>0){var d=0,e="";$.each(c,function(a,c){if(c.Counts>0){d+=c.Counts;var f=b;e+='<div class="micro-home-album"><div class="img-'+c.UrlRewriteName+'">'+'<a href="'+f+'">'+'<img src="'+c.DefaultImageUrl+'"/>'+"</a>"+"</div>"+'<div class="album">'+'<a href="'+f+'">'+c.Name+"</a></div>"+'<div class="by"><span class="pics-'+c.UrlRewriteName+'-countable">'+c.Counts+"</span> "+Text.photo+"</div>"+"</div>",$(".pics-"+c.UrlRewriteName+"-countable").html(c.Counts),$(".pics-"+c.UrlRewriteName+"-countable1").html("("+c.Counts+")")}}),$(".predefine-album-box").html(e),$(".pics-countable").html(d)}}),$.get("/Gallery/RestaurantFeatureGallery?restaurantId="+a+"&restaurantName=",function(a){$(".feature-gallery").html(a)})}function bindEditOrDeleteReviewTooltip(){$("a.review-modified").tipsy({gravity:"s",live:!0}),$("a.review-deleted").tipsy({gravity:"s",live:!0})}function addRestaurantChecked(a){var b=new Date;$(".checkin-restaurant-waiting").show(),$.ajax({type:"GET",url:"/Common/IsLogin?"+b.getTime(),success:function(b){if(b.success==1){var c=$(a).attr("resId");prepareForAddRestaurantCheckIn(c)}else LoginPopup.Show(function(){var b=$(a).attr("resId");closeNewReviewPopup(),prepareForAddRestaurantCheckIn(b)},function(){$(".checkin-restaurant-waiting").hide()})}})}function prepareForAddRestaurantCheckIn(a){var b=new Date;$.ajax({type:"GET",url:"/Restaurant/AddCheckIn?restaurantId="+a+"&"+b.getTime(),success:function(a){$(".checkin-restaurant-waiting").hide();if(a.success==1)$(".from-review .count-checkedin").text(a.totalCheckedIn),$(".restaurant_checkin").removeClass("checkin").addClass("checkin_act");else switch(a.errorType){case 1:alert("Bạn chưa đăng nhập");break;case 4:$(".restaurant_checkin.checkin").removeClass("checkin").addClass("checkin_act"),alert(CommonText.AlreadyCheckin)}}})}function updateRestaurantCheckedInStatus(){var a=$(".restaurant_checkin").attr("resId");if(a!=null){var b=new Date;$.ajax({type:"GET",url:"/Restaurant/IsCheckedIn?restaurantId="+a+"&"+b.getTime(),success:function(a){if(a.success==1)a.canchecked?$(".restaurant_checkin.checkin_act").removeClass("checkin_act").addClass("checkin"):$(".restaurant_checkin.checkin").removeClass("checkin").addClass("checkin_act");else switch(a.errorType){case 1:alert(ReviewText.NotLogin)}}})}}function LoadBreadCrumb(){var a=!0,b=!1,c=!1,d=new Date;$.get("/Review/GetReviewStatistic?isreview="+a+"&ispr="+b+"&isqa="+c+"&d="+d.getTime(),function(a){if(a.success){var b=a.data;$('#breadcrumddl [refval=""] > span').text(addCommas(b.TotalReviews,",")),$('#breadcrumddl [refval="nha-hang"] > span').text(addCommas(b.ResTotalReviews,",")),$('#breadcrumddl [refval="quan-an"] > span').text(addCommas(b.QuanAnTotalReviews,",")),$('#breadcrumddl [refval="cafe"] > span').text(addCommas(b.CafeTotalReviews,",")),$('#breadcrumddl [refval="tiem-banh"]>span').text(addCommas(b.TiemBanhTotalReviews,",")),$('#breadcrumddl [refval="bar-pub"]>span').text(addCommas(b.BarTotalReviews,",")),$('#breadcrumddl [refval="karaoke"]>span').text(addCommas(b.KaraokeTotalReviews,",")),$('#breadcrumddl [refval="khu-du-lich"]>span').text(addCommas(b.ResortTotalReviews,",")),$('#breadcrumddl [refval="billiards"]>span').text(addCommas(b.BillardTotalReviews,",")),$('#breadcrumddl [refval="tiec-cuoi-hoi-nghi"]>span').text(addCommas(b.EventTotalReviews,",")),$('#breadcrumddl [refval="cua-hang"]>span').text(addCommas(b.StoreTotalReviews,",")),$('#breadcrumddl [refval="an-vat-via-he"]>span').text(addCommas(b.AnVatViaHeTotalReviews,",")),$('#breadcrumddl [refval="sang-trong"]>span').text(addCommas(b.SangTrongTotalReviews,",")),$('#breadcrumddl [refval="giai-tri"]>span').text(addCommas(b.GiaiTriTotalReviews,",")),$('#breadcrumddl [refval="spa-massage"]>span').text(addCommas(b.SpaMassageTotalReviews,","))}})}function bindPRQATooltip(){$(".review-pr").tipsy({gravity:"s"}),$(".review-qa").tipsy({gravity:"s"})}function bindReviewReportErrorWithoutLogined(){$("a.review-report-error").live("click",function(){loginForReviewReportSuccess(this)})}function loginForReviewReportSuccess(a){LoginPopup.Show(function(){$.modal.close(),bindReviewReportErrorWithLogined(),$("body,html").animate({scrollTop:$(a).position().top},800),$(a).effect("highlight",{},3e3),setTimeout(function(){$(a).click()},1e3)})}function bindReviewReportItem(a){var b=$(a).attr("reviewid");$(a).qtip({content:" ",show:{event:"click"},position:{my:"top center",at:"bottom center"},hide:{event:"unfocus",fixed:!0},events:{show:function(a,c){var d=$("#review-report-dialog");d.length&&c.set("content.text",d),$("#review-error-hd").val(b),$("#review-report-dialog .correctinfotextbox").val(""),$("#review-report-dialog .report-success").empty(),$("#review-report-dialog .report-fail").empty(),$("#review-report-dialog .correctinfotextbox").watermark(CommonText.InformationWatermark,{className:"comment-watermark"})}}})}function bindReviewReportByReviewId(a){isLogin&&bindReviewReportItem($("#review-"+a+" .review-report-error"))}function bindReviewReportErrorWithLogined(){isLogin=!0,$("a.review-report-error").die("click"),$("a.review-report-error").live("click",function(){return!1}),$("a.review-report-error").each(function(){bindReviewReportItem(this)}),$("#review-report-dialog .send-resinfo-error").live("click",function(){if($.trim($("#review-report-dialog .correctinfotextbox").val())!=""){var a={reviewId:$("#review-error-hd").val(),errorkeyname:$("#review-report-dialog .errorkeyname").text(),correctinfo:$("#review-report-dialog .correctinfotextbox").val(),istrue:!1,reporturl:window.location.href};postReviewReport(a,"#review-report-dialog")}else $("#review-report-dialog .report-fail").text(CommonText.PlsInputInfor),$("#review-report-dialog .report-success").text("")})}function postReviewReport(a,b){$(b+" .report-wating").show(),$.post("/Review/AddReportError",a,function(a){a.success?($(b+" .report-wating").hide(),$(b+" .report-success").text("Cám ơn bạn"),$(b+" .report-fail").text(""),$(b+" .correctinfotextbox").val("")):alert(a.errorType)})}function getCurrentPageIndex(){var a=getFilterTabType(),b=0;switch(a){case 1:b=scrollPageIndex;break;case 2:b=prPageIndex;break;case 3:b=qnaPageIndex;break;default:b=scrollPageIndex}return b}function increaseCurrentPageIndex(){var a=getFilterTabType(),b=0;switch(a){case 1:scrollPageIndex++;break;case 2:prPageIndex++;break;case 3:qnaPageIndex++;break;default:scrollPageIndex++}}function getTotalItem(){var a=getFilterTabType(),b=0;switch(a){case 1:b=totalReviews;break;case 2:getCurrentPageIndex()==0?b=100:b=totalPRs;break;case 3:getCurrentPageIndex()==0?b=100:b=totalQAs;break;default:b=totalReviews}return b}function setTotalItem(a){var b=getFilterTabType();switch(b){case 1:totalReviews=a;break;case 2:totalPRs=a;break;case 3:totalQAs=a;break;default:totalReviews=a}}function getItemContainer(){var a=getFilterTabType(),b="#review-list";switch(a){case 1:b="#review-list";break;case 2:b="#pr-list";break;case 3:b="#qna-list";break;default:b="#review-list"}return b}function updateFilterTitle(){var a=getFilterTabType(),b=CommonText.review;switch(a){case 1:b=CommonText.review;break;case 2:b=CommonText.PRLower;break;case 3:b=CommonText.QALower;break;case 4:b=CommonText.CheckinLower;break;default:b=CommonText.review}$("#filter-title").text(b)}function setEmptyDivPane(){var a=getFilterTabType();switch(a){case 1:$("#review-list").html('<div class="micro-home-recent-review review-item empty">'+ReviewText.HaveNoReview+"</div>");break;case 2:$("#pr-list").html('<div class="micro-home-recent-review review-item empty">'+ReviewText.HaveNoPR+"</div>");break;case 3:$("#qna-list").html('<div class="micro-home-recent-review review-item empty">'+ReviewText.HaveNoQA+"</div>");break;default:$("#review-list").html('<div class="micro-home-recent-review review-item empty">'+ReviewText.HaveNoReview+"</div>")}}function getFilterTabType(){var a=parseInt($("ul.review-tabs > li > a.current").closest("li").attr("type"));return a}function updateReviewTabs(a){$("ul.review-tabs li a").removeClass("current"),$("a",a).addClass("current"),$("div.micro-reviews > div.tab-panes > div").hide(),$($(a).data("tabcontent")).show(),updateFilterTitle()}function deleteComment(a){if(confirm(Text.MsgConfirmDeletePhotoComment)==1){var b=$(a).attr("commentId");b!=null&&b!=0&&$.post("/Review/RemoveComment",{commentId:b},function(b){b.Success&&$(a).closest(".review-reply-item").remove()})}}function IsFiltering(){if($("#ddlCriteria").val()!=null&&$("#ddlLevel").val()!=null&&$("#ddlOrderByTime").val()!=null)if($("#ddlCriteria").val()!="0"||$("#ddlLevel").val()!="0"||$("#ddlOrderByTime").val()!="true")return!0;return!1}function RecookComment(a){return a.IsLiked=ko.observable(a.IsLiked),a.TotalLike=ko.observable(a.TotalLike),a}function RecookReviews(a,b){var c=new Array;for(var d=0;d<a.length;d++){var e=new GroupItem(a[d]);if(b==1&&a[d].ReviewType==4&&(a[d].Comment==null||a[d].Comment=="")&&a[d].TotalPictures==0){var f=d+1;while(f<a.length&&a[f].ReviewType==4)e.items.push(a[f]),f++;f>d+1&&(e.type=5,d=f-1)}c.push(e)}return c}function resetFiltering(a){$("#ddlCriteria").val(0),$("#ddlLevel").val(0),$("#ddlOrderByTime").val(!0)}function removeUserTooltip(a){$("#userTooltip_"+a).remove(),$("#userTooltip_v_"+a).remove()}function updateRestaurantSummaryCanView(){$(".btn-sum-detail").hide(),$(".microsite-box-rating-new").css("opacity",1)}function insertHomeReviewAds(a,b){$(a).insertAfter($("#review-list>div.nonads:nth("+b+")")),$(a).show()}function selectAndInsertHomeReviewAds(a){var b=$(".ads-banner.hide:nth(0)");b&&($(b).removeClass("hide").addClass("added"),insertHomeReviewAds(b,a))}function autoInsertReviewAds(){setTimeout(function(){var a=$("#review-list>div.nonads").length,b=$("#review-list>div.ads-banner.added").length,c=$(".ads-banner.hide").length;while(a>(b+1)*insertAdsRate&&c>0)selectAndInsertHomeReviewAds((b+1)*insertAdsRate-1),b=$("#review-list>div.ads-banner.added").length,c=$(".ads-banner.hide").length},500)}function addMobileTooltip(a){if($(a).attr("tooltip")!="none"){var b=$(this).width();b*=-1;var c=$(a).attr("tooltip");$(a).tooltip({tip:"#"+c,position:"bottom center",offset:[6,0],delay:50,tipClass:"mobileapptooltip"})}}function bindReviewMoblieTooltip(a){$("#review-"+a+" a.viamobile").each(function(){addMobileTooltip(this)}),$("#checkin-"+a+" a.viamobile").each(function(){addMobileTooltip(this)})}typeof staticPath=="undefined"&&(staticPath="");var loginSuccessCallback;$(function(){$("a.remove-review-comment").live("click",function(a){deleteComment(this)})}),$(".link-to-facebook").live("click",function(){var a=$(this).attr("resid");LinkToFacebook(function(){closeNewReviewPopup(),UploadReview.LoadAddNewReviewForm(a)})}),$(".checkin-link-to-facebook").live("click",function(){LinkToFacebook(function(){$("#checkin-facebook-share .unshare_facebook").hide(),$("#checkin-facebook-share .share_facebook").show(),$("#checkin-share-facebook-check span.checkbox").addClass("check"),$("#checkin_hdshareOnFacebook").val(!0),$("#checkin_hdhasShareOnFacebook").val(!0)})});var isSubmittingComment=!1;$("a.review-modified").live("click",function(){var a=$(this).attr("restaurantId"),b=$(this).attr("reviewId");return UploadReview.LoadModifiedReviewForm(b,a),!1});var isReviewDetailPage=!1;$("a.review-deleted").live("click",function(){if(confirm(ReviewText.DeleteConfirmMsg)){var a=$(this).attr("reviewId"),b=$(this).attr("restaurantId"),c=$(this).attr("returnUrl"),d=new Date;$(".tipsy").remove(),$.ajax({type:"GET",url:"/Review/UpdateReviewAsTrash?reviewId="+a+"&"+d.getTime(),success:function(d){if(d.Success)$("#review-"+a).remove(),isReviewPage?(typeof homeReviewsModel!="undefined"&&homeReviewsModel!=null&&homeReviewsModel.removeReview(a),typeof resReviewsModel!="undefined"&&resReviewsModel!=null&&resReviewsModel.removeReview(a),updateTotalReviewsAndPicturesByUsername(d.Statistic.UserName,d.Statistic.TotalReviews,d.Statistic.TotalPictures),LoadReviewSummaryBox(b),UpdateMicrositePictures(b,c),getFilterTabType()==1&&IncreaseGlobalTotalReview(-1)):window.location=c+"/binh-luan",PointNotify.RemovedPointNotify(d.TotalRemovedPoints);else switch(d.ErrorType){case 3:alert(ReviewText.NotLogin);break;case 1:alert(ReviewText.CannotDeleteIfNotOwner);break;case 2:alert(ReviewText.DeleteTimeIsOver);break;case 4:alert(ReviewText.CannotDeleteIfApproved)}}})}return!1}),$(".restaurant_checkin").live("click",function(){return addRestaurantChecked(this),!1});var isLogin=!1;window.onpopstate=function(a){a.state&&updateReviewTabs($('ul.review-tabs li[data-tabcontent="'+a.state.tab+'"]'))};var ListReviewsModel=function(a){var b=this;isLogin=a.IsLogin,isLogin||bindReviewReportErrorWithoutLogined(),b.count=a.Count,b.total=ko.observable(a.Total),b.totalRemaining=ko.observable(a.Total-b.count),b.lastId=a.LastId,b.currentTimestamp=a.CurrentTimestamp,currentTimeStamp=a.CurrentTimestamp,b.reviews=ko.observableArray(RecookReviews(a.Reviews,!0)),b.isReview=ko.observable(!0),b.isPR=ko.observable(!1),b.isQA=ko.observable(!1),b.isCheckin=ko.observable(!1),b.categoryId=ko.observable(0),b.categoryUrlRewriteName=ko.observable(""),b.provinceId=ko.observable(a.ProvinceId),b.isPaging=!0,b.isLoading=ko.observable(!1),b.showContinue=ko.observable(!1),b.currentUserUrl=ko.observable(a.CurrentUserProfileUrl),b.currentUserAvatar=ko.observable(a.CurrentUserAvatar),a.ViewedUserId!=null&&(b.userId=ko.observable(a.ViewedUserId)),b.resId=a.ResId,b.hasFiltered=a.HasFiltered,b.resUrl=a.ResUrl,b.resName=ko.observable(a.ResName),b.criteria=ko.observable(0),b.level=ko.observable(0),b.orderByTime=ko.observable(!0),b.isRecommended=ko.observable(a.IsRecommended),b.fullTotal=ko.observable(a.FullTotal),b.reviewTabClick=function(a,c){c.preventDefault(),b.isReview(!1),b.isPR(!1),b.isQA(!1),b.isCheckin(!1),updateReviewTabs(c.currentTarget);var d=$(c.currentTarget).attr("data-tabcontent"),e="",f=reviewUrl;switch(d){case"#review-tab":f=reviewUrl+"/binh-luan",e=window.location.hash,e!=""&&(f+=e),b.isReview(!0);break;case"#pr-tab":f=reviewUrl+"/quang-cao",b.isPR(!0),b.reviewPRs()==null&&b.loadReviews(!1,2);break;case"#qna-tab":f=reviewUrl+"/hoi-dap",b.isQA(!0),b.reviewQAs()==null&&b.loadReviews(!1,2);break;case"#checkin-tab":f=reviewUrl+"/check-in",b.isCheckin(!0),b.checkins()==null&&b.loadReviews(!1,2)}typeof window.history!="undefined"&&window.history.pushState({tab:d+e},document.title,f)},b.reviewPRs=ko.observableArray(null),b.totalPRs=ko.observable(a.TotalPRReviews),b.totalPRRemaining=ko.observable(0),b.lastPRId=0,b.reviewQAs=ko.observableArray(null),b.totalQAs=ko.observable(a.TotalQAReviews),b.totalQARemaining=ko.observable(0),b.lastQAId=0,b.checkins=ko.observableArray(null),b.totalCheckins=ko.observable(a.TotalCheckins),b.totalCheckinRemaining=ko.observable(0),b.lastCheckinId=0,b.filterClick=function(a){switch(a){case"review":b.isReview(!b.isReview()),b.loadReviews(!1);break;case"pr":b.isPR(!b.isPR()),b.loadReviews(!1);break;case"qa":b.isQA(!b.isQA()),b.loadReviews(!1)}},b.afterRenderCommentCallback=function(a,b){bindingUserTooltipById(b.OwnerId),bindCommentPostedTime(b.ReviewId)},b.aferRenderReviewItemCallback=function(a,c){c.AvgRating!="0.0"&&bindReviewRatingTooltipAjaxLoading(c.Id),bindAutoResize(c.Id),bindCommentWatermark(c.Id),bindUserTooltipAjaxLoading(c.Id),bindPostedTime(c.Id),bindEditOrDeleteReviewTooltip(),bindPRQATooltip(),bindReviewReportByReviewId(c.Id),bindReviewContentExpander(),bindHelpfulTooltipByReviewId(c.Id),bindHelpfulNameTooltip(),bindingUserTooltipById(c.OwnerId),bindCommentPostedTime(c.Id),bindReviewMoblieTooltip(c.Id),$(".reviews-main-item").length<(numberScrollablePage+1)*b.count&&$(".reviews-main-item").length>0?b.showContinue(!1):b.showContinue(!0),$(".user-reviews.review-item").length<(numberScrollablePage+1)*b.count&&$(".user-reviews.review-item").length>0?b.showContinue(!1):b.showContinue(!0)},b.afterRenderPicturesCallback=function(a,b){var c=b;switch(c.Template){case"SinglePictureView":case"DoublePictureView":case"TriplePictureView":case"NormalPictureView":case"PortraitPictureView":$(".review-img-"+c.Pictures.Items[0].ReviewID).foodybox();break;case"LandscapePictureView":$(".review-img-"+c.Pictures.Items[0].ReviewID).foodybox(),$(".show-pic-"+c.Pictures.Items[0].ReviewID).click(function(a){a.preventDefault();var b=$(".review-img-"+c.Pictures.Items[0].ReviewID).first();b.click()})}},b.pictureNormalMaxIndex=11,b.picturePortraitMaxIndex=2,b.pictureLandscapeMaxIndex=2,b.getLoadLink=function(a,c){var d=new Date,e="";switch(c){case 1:e="/review/gethomereviews?t="+d.getTime()+"&provinceId="+b.provinceId(),b.categoryUrlRewriteName()!=null&&b.categoryUrlRewriteName()!=0&&(e+="&categoryUrlRewriteName="+b.categoryUrlRewriteName()),b.lastId!=null&&b.lastId!=0&&a&&(e+="&lastId="+b.lastId);break;case 2:e="/review/getresreviews?t="+d.getTime()+"&resId="+b.resId,!b.isQA()&&!b.isPR()&&!b.isCheckin()?(e+="&criteria="+b.criteria(),e+="&level="+b.level(),e+="&orderAscByTime="+b.orderByTime(),e+="&isRecommended="+b.isRecommended(),b.lastId!=null&&b.lastId!=0&&a&&(e+="&lastId="+b.lastId)):b.isQA()?b.lastQAId!=null&&b.lastQAId!=0&&a&&(e+="&lastId="+b.lastQAId):b.isPR()?b.lastPRId!=null&&b.lastPRId!=0&&a&&(e+="&lastId="+b.lastPRId):b.isCheckin()&&(e="/review/GetResCheckins?t="+d.getTime()+"&resId="+b.resId,b.lastCheckinId!=null&&b.lastCheckinId!=0&&a&&(e+="&lastId="+b.lastCheckinId));break;case 3:e="/review/getuserreviews?t="+d.getTime()+"&userid="+b.userId(),b.lastId!=null&&b.lastId!=0&&a&&(e+="&lastId="+b.lastId)}return b.isReview()?e+="&isreview=true":e+="&isreview=false",b.isPR()?e+="&ispr=true":e+="&ispr=false",b.isQA()?e+="&isqa=true":e+="&isqa=false",e},b.loadReviews=function(a,c){var d=b.totalRemaining();c==2&&(b.isPR()?d=b.totalPRRemaining():b.isQA()?d=b.totalQARemaining():b.isCheckin()&&(d=b.totalCheckinRemaining())),c!=3;if(!b.isLoading()&&d>0&&a||!a&&!b.isLoading()){b.isLoading(!0),b.showContinue(!1),c==null&&(c=1);var e=b.getLoadLink(a,c);b.isPaging=a,$.get(e,function(d){if(d.success){var e=d.data,f=null;b.isCheckin()?f=RecookReviews(e.Checkins,!1):f=RecookReviews(e.Reviews,!0);if(a){if(c==1||c==2&&!b.isPR()&&!b.isQA()&&!b.isCheckin()||c==3){for(var g=0;g<f.length;g++)b.reviews.push(f[g]);b.lastId=e.LastId,b.totalRemaining(e.Total-b.count),autoInsertReviewAds()}else if(b.isPR()){for(var g=0;g<f.length;g++)b.reviewPRs.push(f[g]);b.lastPRId=e.LastId,b.totalPRRemaining(e.Total-b.count)}else if(b.isQA()){for(var g=0;g<f.length;g++)b.reviewQAs.push(f[g]);b.lastQAId=e.LastId,b.totalQARemaining(e.Total-b.count)}else if(b.isCheckin()){for(var g=0;g<f.length;g++)b.checkins.push(f[g]);b.lastCheckinId=e.LastId,b.totalCheckinRemaining(e.Total-b.count)}b.isLoading(!1),b.currentUserAvatar(e.CurrentUserAvatar),b.currentUserUrl(e.CurrentUserProfileUrl)}else c==1||c==2&&!b.isPR()&&!b.isQA()&&!b.isCheckin()||c==3?(b.reviews(f),b.lastId=e.LastId,b.total(e.Total),b.totalRemaining(e.Total-b.count)):b.isPR()?(b.reviewPRs(f),b.lastPRId=e.LastId,b.totalPRs(e.Total),b.totalPRRemaining(e.Total-b.count)):b.isQA()?(b.reviewQAs(f),b.lastQAId=e.LastId,b.totalQAs(e.Total),b.totalQARemaining(e.Total-b.count)):b.isCheckin()&&(b.checkins(f),b.lastCheckinId=e.LastId,b.totalCheckins(e.Total),b.totalCheckinRemaining(e.Total-b.count)),b.currentUserAvatar(e.CurrentUserAvatar),b.currentUserUrl(e.CurrentUserProfileUrl),b.isLoading(!1)}else b.isLoading(!1)}),c==1&&LoadBreadCrumb()}},b.getYoutubeEmbed=function(a){return'<object width="500" height="375"><param name="movie" value="http://www.youtube.com/v/'+a.YoutubeCode+'?hl=en_US&amp;version=3;hd=1;rel=0;showinfo=0;cc_load_policy=1;showsearch=0;ap=%2526fmt%3D18"/>'+'<param name="allowFullScreen" value="true"></param>'+'<param name="allowscriptaccess" value="always"></param>'+'<embed src="http://www.youtube.com/v/'+a.YoutubeCode+'?hl=en_US&amp;version=3;autoplay=0&amp;loop=0;hd=2;rel=0;showinfo=0;cc_load_policy=1;showsearch=0;ap=%2526fmt%3D18" type="application/x-shockwave-flash" width="500" height="375" allowscriptaccess="always" allowfullscreen="true"></embed>'+"</object>"},CalculatingReviewPostedTime(),b.reviewFilterChange=function(a,c){switch(c.currentTarget.id){case"ddlCriteria":b.criteria(c.currentTarget.value);break;case"ddlLevel":b.level(c.currentTarget.value);break;case"ddlOrderByTime":b.orderByTime(c.currentTarget.value)}b.loadReviews(!1,2)},b.categoryChange=function(a){b.categoryUrlRewriteName($(a).attr("refval")),$("#breadcrumddl>li").removeClass("selected"),$(a).closest("li").addClass("selected"),b.loadReviews(!1)},b.continueLoad=function(){b.loadReviews(!0)},b.continueLoadResReview=function(){b.loadReviews(!0,2)},b.continueLoadUserReview=function(){b.loadReviews(!0,3)},b.addNewReview=function(a){b.reviews.unshift(new GroupItem(a)),b.total(b.total()+1),b.fullTotal(b.fullTotal()+1)},b.replaceReview=function(a){for(var c=0;c<b.reviews().length;c++)if(b.reviews()[c].items[0].Id==a.Id){b.reviews.splice(c,1,new GroupItem(a));break}},b.removeReview=function(a){for(var c=0;c<b.reviews().length;c++)if(b.reviews()[c].items[0].Id==a){b.reviews.splice(c,1);break}b.total(b.total()-1),b.fullTotal(b.fullTotal()-1)},b.checkinGroupDetails=ko.observableArray([]),b.showCheckinDetails=function(a){$("#checkin-group-dialog").modal({persist:!0}),$("#simplemodal-container").css("height","440px"),$("#simplemodal-container").css("width","500px"),$(window).resize();var c=new Date,d=a.items[0].Id,e=a.items[a.items.length-1].Id;b.isLoadingCheckinDetail(!0),$.get("/review/GetResCheckinsByGroup?t="+c.getTime()+"&resId="+b.resId+"&firstId="+d+"&lastId="+e,function(a){a.success&&(b.checkinGroupDetails(a.data),b.isLoadingCheckinDetail(!1))})},b.checkinGroupDetails=ko.observableArray([]),b.isLoadingCheckinDetail=ko.observable(!1),b.afterGenderCheckinGroupItem=function(a,b){var c=$('span.address[id="'+b.Id+'"]');calculatingPostedTime(currentTimeStamp,c)},b.getReviewDetailLink=function(a){return typeof a.ResUrl!="undefined"&&a.ResUrl!=null?"http://www.foody.vn"+a.ResUrl+"/binh-luan-"+a.Id:"http://www.foody.vn"+b.resUrl+"/binh-luan-"+a.Id},b.getTopByRank=function(a){var b=a.PointRank,c=0;return b>0&&b<=10?c=10:b<=50?c=50:b<=100?c=100:b<=500?c=500:b<=1e3&&(c=1e3),"Top "+c},b.commentLikeLoading=ko.observable(!1),b.commentLike=function(a){if(!b.commentLikeLoading()){b.commentLikeLoading(!0);var c=!a.IsLiked(),d="/likecomment/like/",e=1;c||(d="/likecomment/unlike/",e=-1);var f={id:a.CommentId,type:3};$.post(d,f,function(d){d.Success?(a.TotalLike(a.TotalLike()+e),a.IsLiked(c),b.commentLikeLoading(!1)):b.commentLikeLoading(!1)})}},b.getCommentLikeText=function(a){return a.IsLiked()?"Unlike":"Like"}};ListReviewsModel.ChangeReviewFilter=function(){var a=window.location.hash,b=0;switch(a){case"#tuyet-voi":b=1;break;case"#kha-tot":b=2;break;case"#trung-binh":b=3;break;case"#kem":b=4}b!=0&&setTimeout(function(){$("#ddlLevel").val(b),resReviewsModel.level(b),resReviewsModel.loadReviews(!1,2)},500)};var GroupItem=function(a){var b=this;b.reviewId=a.ReviewType!=4?a.Id:0,b.type=a.ReviewType,b.items=new Array;if(a.Comments!=null)for(var c=0;c<a.Comments.length;c++)RecookComment(a.Comments[c]);a.Comments=ko.observableArray(a.Comments),b.items.push(a),b.isSubmitingComment=ko.observable(!1),b.addComment=function(c,d){var e=d.keyCode,f=0;f=d.shiftKey;if(e==13&&!f){if(!b.isSubmitingComment()){b.isSubmitingComment(!0);var g=b.reviewId,h=$.trim($(d.target).val());h!=""?$.ajax({type:"POST",url:"/Review/AddComment2",data:{reviewId:g,comment:htmlEncode(h)},success:function(c){c.success?(updateTotalComment(g),$(d.target).val(""),a.Comments.push(RecookComment(c.data)),PointNotify.AddedPointNotify(c.TotalPendingPoints),b.isSubmitingComment(!1)):b.isSubmitingComment(!1)}}):b.isSubmitingComment(!1)}return!1}return!0},b.isLoadingAllComment=ko.observable(!1),b.showAllComments=function(c,d){if(!b.isLoadingAllComment()){b.isLoadingAllComment(!0);var e=new Date;$.get("/review/getallcomments?t="+e.getTime()+"&reviewid="+a.Id,function(c){if(c.success){var e=c.data;if(e!=null){a.Comments.removeAll();for(var f=0;f<e.length;f++)a.Comments.push(RecookComment(e[f]))}$(d.target).closest(".view-all-comments").hide(),b.isLoadingAllComment(!1)}else b.isLoadingAllComment(!1)})}}},lastScrollTop=0;$(function(){ListReviewsModel.ChangeReviewFilter(),$(window).bind("hashchange",function(a){ListReviewsModel.ChangeReviewFilter()}),$(window).scroll(function(){var a=$(this).scrollTop();$(window).scrollTop()>$(document).height()-($(window).height()+1e3)&&a>lastScrollTop&&(typeof homeReviewsModel!="undefined"&&homeReviewsModel!=null&&$(".reviews-main-item").length<(numberScrollablePage+1)*homeReviewsModel.count&&homeReviewsModel.loadReviews(!0),typeof resReviewsModel!="undefined"&&resReviewsModel!=null&&$(".review-item").length<(numberScrollablePage+1)*resReviewsModel.count&&resReviewsModel.loadReviews(!0,2),typeof userReviewsModel!="undefined"&&userReviewsModel!=null&&$(".review-item").length<(numberScrollablePage+1)*userReviewsModel.count&&userReviewsModel.loadReviews(!0,3)),lastScrollTop=a}),$(".btn-sum-detail").click(function(){LoginPopup.Show(function(){$.modal.close(),updateRestaurantSummaryCanView(),$(".microsite-box-rating-new").effect("highlight",{},1e3)},function(){})}),autoInsertReviewAds(),setTimeout(function(){addCommentWatermark()})});var insertAdsRate=3
  74. ;function populateReviewItem(a,b){if(a!=null){var c=getRatingTooltip(a.Review),d="--";a.Review.AvgRating>0&&(d=a.Review.AvgRating.toFixed(1));var e='<div id="review-'+a.Review.Id+'"><div class="';a.Type==1?e+="micro-home-recent-review ":a.Type==2?e+="user-reviews ":a.Type==3&&(e+="reviews-new-item "),e+='review-item" reviewId="'+a.Review.Id+'" itemprop="review" itemscope itemtype="http://schema.org/Review">'+'<article class="micro-home-review-item">'+'<div class="leftimage">';if(a.Type==1)e+='<div><a href="'+a.Review.UserProfileUrl+'" class="review-user-link" tooltip="#userToolTip_'+a.Review.Id+'"><img witdh="60px" height="60px" src="'+a.Review.CropAvatarUrl+'"/></a></div>'+'<div class="user"><a href="'+a.Review.UserProfileUrl+'" class="review-user-link" tooltip="#userToolTip_'+a.Review.Id+'"><span itemprop="author">'+a.Review.UserFirstName+"</span></a></div>"+'<div class="status" userreviews="userReviews_'+a.Review.UserName+'">'+a.Review.UserReviews+" "+CommonText.review+"</div>"+generateUserTooltip(a.Review),a.CanEdit&&(e+='<a href="javascript:void(0);" class="review-modified" restaurantId="'+a.Review.RestaurantID+'" reviewId="'+a.Review.Id+'" title="'+ReviewText.EditIn1Hour+'"></a>'+'<a href="javascript:void(0);" class="review-deleted" restaurantId="'+a.Review.RestaurantID+'" reviewId="'+a.Review.Id+'" title="'+ReviewText.DeleteIn1Hour+'"></a>');else if(a.Type==2||a.Type==3)e+='<div><a href="'+a.Review.RestaurantMicrositeUrl+'"><img witdh="80px" src="'+a.Review.RestaurantPictureUrl+'"/></a></div>'+'<div class="restaurant-point">',a.Review.RestaurantAvgRating>0?e+='<span itemprop="ratingValue" href="#">'+a.Review.RestaurantAvgRating.toFixed(1)+"</span>":e+='<span itemprop="ratingValue" href="#">--</span>',e+="</div>";e+='</div><div class="rightdesc">';if(a.Type==1)e+='<div><div class="title"><a itemprop="description" href="'+a.Review.RestaurantMicrositeUrl+"/binh-luan-"+a.Review.Id+'">'+a.Review.Title+"</a></div>",a.Review.ReviewType==1?e+='<div class="review-point" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><a itemprop="ratingValue" onclick="return false;" href="javascript:void(0);" reviewid="'+a.Review.Id+'" tooltip="ratingTooltip_'+a.Review.Id+'" >'+d+"</a>"+"</div>":a.Review.ReviewType==2?e+='<div class="review-pr" title="Quảng cáo"></div>':a.Review.ReviewType==3&&(e+='<div class="review-qa" title="Hỏi đáp"></div>'),e+='</div><div class="timerow"><span class="address" itemprop="datePublished" data-utime="'+a.PostedTimestamp+'" title="'+formatJSONDate(a.Review.CreatedOn)+'"></span>',a.Review.PostedByDeviceName!=null&&a.Review.PostedByDeviceName!=""&&(e+=' <a class="viamobile" href="/ung-dung-mobile">via '+a.Review.PostedByDeviceName,e+='<img src="'+staticPath+'Style/images/icons/icon-via-mobile.png" class="iphone" /></a>'),e+="<div>";else if(a.Type==2||a.Type==3)e+='<div class="reviews-headers"><h1 class="restitle"><a href="'+a.Review.RestaurantMicrositeUrl+'">'+a.Review.RestaurantName+"</a> ("+a.Review.RestaurantTotalReviews+" bình luận)</h1>"+'<div class="resaddress">'+a.Review.RestaurantAddress+", "+a.Review.RestaurantDistrictName+", "+a.Review.RestaurantProvinceName+"</div>"+'<h2 class="title"><a itemprop="description" href="'+a.Review.RestaurantMicrositeUrl+"/binh-luan-"+a.Review.Id+'">'+a.Review.Title+"</a></h2>"+'<div class="user" itemprop="author">',a.Type==3&&(e+='<a href="'+a.Review.UserProfileUrl+'" class="review-user-link" tooltip="#userToolTip_'+a.Review.Id+'"> <img src="'+a.Review.CropAvatarUrl+'" style="width:30px; height:30px; float:left; vertical-align:middle; margin-right:5px;"/><span>'+a.Review.UserFirstName+"</span></a> ("+a.Review.UserReviews+" bình luận) | "),e+='<span class="address" style="float:none; border:none" itemprop="datePublished" data-utime="'+a.PostedTimestamp+'" title="'+formatJSONDate(a.Review.CreatedOn)+'"></span>',a.Review.PostedByDeviceName!=null&&a.Review.PostedByDeviceName!=""&&(e+=' <a class="viamobile" href="/ung-dung-mobile">via '+a.Review.PostedByDeviceName,e+='<img src="'+staticPath+'Style/images/icons/icon-via-mobile.png" class="iphone" /></a>'),e+="</div>",e+=generateUserTooltip(a.Review),a.Review.ReviewType==1?e+='<div class="review-point" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta content="10" itemprop="bestRating"><a itemprop="ratingValue" href="javascript:void(0);" onclick="return false;" reviewid="'+a.Review.Id+'" tooltip="ratingTooltip_'+a.Review.Id+'" >'+d+"</a>"+"</div>":a.Review.ReviewType==2?e+='<div class="review-pr" title="Quảng cáo"></div>':a.Review.ReviewType==3&&(e+='<div class="review-qa"  title="Hỏi đáp"></div>'),e+="</div>";e+='<div class="desc" itemprop="reviewBody" style="white-space: pre-line;">'+a.Review.Comment+"</div>"+generateReviewOptions(a.Review)+addYoutube(a.Review.YoutubeCode)+'<div id="review-pictures'+a.Review.Id+'"></div>'+generateReviewShare(a.Review)+generateReviewComments(a.CommentsList,a.IsLogin)+"</div>"+"</article>"+"</div>"+"</div>",b==null&&(b="#review-list"),$(b).append(e),a.Review.AvgRating>0&&generateRatingTooltipContent(a.Review),bindAutoResize(a.Review.Id),bindCommentWatermark(a.Review.Id),bindUserTooltipAjaxLoading(a.Review.Id),bindPostedTime(a.Review.Id),bindCommentPostedTime(a.Review.Id),bindEditOrDeleteReviewTooltip(),bindPRQATooltip(),bindReviewReportByReviewId(a.Review.Id),a.Review.TotalPictures>0&&$.get(GetLoadReviewPictureLink(a.Review.Id),function(b){$("#review-pictures"+a.Review.Id).html(b),$(".review-img-"+a.Review.Id).foodybox()})}}function populateHomeReviewItem(a){if(a!=null){var b=getRatingTooltip(a.Review),c="--";a.Review.AvgRating>0&&(c=a.Review.AvgRating.toFixed(1));var d='<div id="review-'+a.Review.Id+'"><div class="';d+='reviews-main-item" reviewId="'+a.Review.Id+'">'+"<article>"+'<div class="rightimage">',d+='<div><a href="'+a.Review.RestaurantMicrositeUrl+'"><img width="140px" src="'+a.Review.RestaurantPictureUrl+'"/></a></div>',d+='<div class="review-home-pop-link"><span><a href="javascript:void(0)" class="restaurant-reviews-link" resid="'+a.Review.RestaurantID+'">'+a.Review.RestaurantTotalReviews+" "+Text.reviews+"</a></span> | "+'<span><a href="'+a.Review.RestaurantMicrositeUrl+'/album-anh">'+a.Review.TotalRestaurantPictures+" "+Text.photos+"</a> </span>"+"</div>",d+='</div><div class="leftcontent">',d+='<div class="reviews-headers"><h1 class="restitle"><a href="'+a.Review.RestaurantMicrositeUrl+'">'+a.Review.RestaurantName+"</a>",a.Review.TotalRestaurantRecentReviews>0&&(d+='<span> (<a href="'+a.Review.RestaurantMicrositeUrl+'" style="font-size:12px; font-weight:normal;color:#02AAD4;text-transform:none;">'+a.Review.TotalRestaurantRecentReviews+" "+ReviewText.ReviewsInDay+"</a>)</span>"),d+='</h1><div class="resaddress">'+a.Review.RestaurantAddress+", "+a.Review.RestaurantDistrictName+", "+a.Review.RestaurantProvinceName+"</div>"+'<div class="reviews-main-inside"><h2 class="title" itemprop="name"><a href="'+a.Review.RestaurantMicrositeUrl+"/binh-luan-"+a.Review.Id+'">'+a.Review.Title+"</a></h2>",a.CanEdit&&(d+='<a href="javascript:void(0);" class="review-modified" restaurantId="'+a.Review.RestaurantID+'" reviewId="'+a.Review.Id+'" title="'+ReviewText.EditIn1Hour+'"></a>'+'<a href="javascript:void(0);" class="review-deleted" restaurantId="'+a.Review.RestaurantID+'" reviewId="'+a.Review.Id+'" title="'+ReviewText.DeleteIn1Hour+'"></a>'),d+='<div class="user" itemprop="author">',d+='<a href="'+a.Review.UserProfileUrl+'" class="user-link" refId="'+a.Review.UserID+'" tooltip="userToolTip_'+a.Review.UserID+'"> <img src="'+a.Review.CropAvatarUrl+'" style="width:30px; height:30px; float:left; vertical-align:middle; margin-right:5px;"/><span>'+a.Review.UserFirstName+"</span>",d+='</a> - <span class="address" style="float:none; border:none" itemprop="datePublished" data-utime="'+a.PostedTimestamp+'" title="'+formatJSONDate(a.Review.CreatedOn)+'"></span>',a.Review.PostedByDeviceName!=null&&a.Review.PostedByDeviceName!=""&&(d+=' <a class="viamobile" href="/ung-dung-mobile">via '+a.Review.PostedByDeviceName,d+='<img src="'+staticPath+'Style/images/icons/icon-via-mobile.png" class="iphone" /></a>'),a.Review.TotalUserRecentReviews>0&&(d+=' | <span><a href="'+a.Review.UserProfileUrl+'" style="color:#02AAD4; font-size:11px; font-weight:normal;text-transform:none;"><c>'+a.Review.TotalUserRecentReviews+"</c> "+ReviewText.ReviewsInDay+"</a></span>"),d+="</div>",a.Review.ReviewType==1?d+='<div class="review-point"><a itemprop="ratingValue" href="javascript:void(0);" onclick="return false;" reviewid="'+a.Review.Id+'" tooltip="ratingTooltip_'+a.Review.Id+'" >'+c+"</a>"+"</div>":a.Review.ReviewType==2?d+='<div class="review-pr" title="Quảng cáo"></div>':a.Review.ReviewType==3&&(d+='<div class="review-qa" title="Hỏi đáp"></div>'),d+='<div class="desc" itemprop="description" style="white-space: pre-line;">'+a.Review.Comment+"</div>"+generateReviewOptions(a.Review)+addYoutubeHome(a.Review.YoutubeCode)+'<div id="review-pictures'+a.Review.Id+'"></div></div></div>'+generateReviewShare(a.Review)+generateReviewComments(a.CommentsList,a.IsLogin)+"</div>"+"</article>"+"</div>"+"</div>",$("#review-list").append(d),a.Review.AvgRating>0&&generateRatingTooltipContent(a.Review),bindAutoResize(a.Review.Id),bindCommentWatermark(a.Review.Id),bindUserTooltipAjaxLoading(a.Review.Id),bindPostedTime(a.Review.Id),bindCommentPostedTime(a.Review.Id),bindEditOrDeleteReviewTooltip(),bindPRQATooltip(),bindReviewReportByReviewId(a.Review.Id),a.Review.TotalPictures>0&&$.get(GetLoadReviewPictureLink(a.Review.Id),function(b){$("#review-pictures"+a.Review.Id).html(b),$(".review-img-"+a.Review.Id).foodybox()})}}function addYoutubeHome(a){var b="";return a!=null&&(b+="<div>",b+='<object width="500" height="375">',b+='<param name="movie" value="http://www.youtube.com/v/'+a+'?hl=en_US&amp;version=3;hd=1;rel=0;showinfo=0;cc_load_policy=1;showsearch=0;ap=%2526fmt%3D18"></param>',b+='<param name="allowFullScreen" value="true"></param>',b+='<param name="allowscriptaccess" value="always"></param>',b+='<embed src="http://www.youtube.com/v/'+a+'?hl=en_US&amp;version=3;autoplay=0&amp;loop=0;hd=2;rel=0;showinfo=0;cc_load_policy=1;showsearch=0;ap=%2526fmt%3D18" type="application/x-shockwave-flash" width="500" height="375" allowscriptaccess="always" allowfullscreen="true"></embed>',b+="</object>",b+="</div>"),b}function addYoutube(a){var b="";return a!=null&&$.trim(a)!=""&&(b+='<div style="float:left; width:500px;margin-top:5px;">',b+='<object width="500" height="375">',b+='<param name="movie" value="http://www.youtube.com/v/'+a+'?hl=en_US&amp;version=3;hd=1;rel=0;showinfo=0;cc_load_policy=1;showsearch=0;ap=%2526fmt%3D18"></param>',b+='<param name="allowFullScreen" value="true"></param>',b+='<param name="allowscriptaccess" value="always"></param>',b+='<embed src="http://www.youtube.com/v/'+a+'?hl=en_US&amp;version=3;autoplay=0&amp;loop=0;hd=2;rel=0;showinfo=0;cc_load_policy=1;showsearch=0;ap=%2526fmt%3D18" type="application/x-shockwave-flash" width="500" height="375" allowscriptaccess="always" allowfullscreen="true"></embed>',b+="</object>",b+="</div>"),b}function bindAutoResize(a){$("#write_comment_"+a).autoresize({minRows:0,buffer:0,animate:!1})}function bindCommentWatermark(a){$("#write_comment_"+a).watermark(ReviewText.CommentWatermark,{className:"comment-watermark",useNative:!1})}function generateReviewOptions(a){var b="";a.SelectMenu!=null&&a.SelectMenu!=""&&(b+='<div class="optionals">Đã thưởng thức: <span>'+a.SelectMenu+"</span></div>");var c="";a.Guest!=null&&a.Guest!=""&&(c=ReviewText.People+": <span>"+a.Guest+"</span>");var d="";a.MoneySpend!=null&&a.MoneySpend!=""&&(d=ReviewText.Cost+": <span>"+a.MoneySpend+"</span>");var e="";a.VisitAgain!=null&&a.VisitAgain!=""&&(e=ReviewText.Comeback+": <span>"+a.VisitAgain+"</span>");if(c!=""||d!=""||e!=""){var f=!1;b+='<div class="optionals">',c!=""&&(b+=c,f=!0),d!=""&&(f?b+=" | "+d:b+=d,f=!0),e!=""&&(f?b+=" | "+e:b+=e),b+="</div>"}return b}function returnZeroAsNull(a){return a==null?0:a}function getRatingTooltip(a){var b='<div class="top-arrow"><img src="'+staticPath+'Style/images/icons/arrow-top.png" alt=""/></div>'+"<div>"+'<h2 style="padding-bottom:5px; border-bottom:#ddd 1px dashed; margin-bottom:5px; font-weight:bold;">'+ReviewText.PointRating+"</h2>"+'<table class="point-popup">'+"<tr>"+'<td width="90">'+ReviewText.Position+"</td>"+"<td>"+'<div id="positionPointBar_'+a.Id+'" class="reviewPointBar">'+"</div>"+"</td>"+'<td width="20" align="right">'+"<b>"+returnZeroAsNull(a.Position)+"</b>"+"</td>"+"</tr>"+"<tr>"+"<td>"+ReviewText.Price+"</td>"+"<td>"+'<div id="pricePointBar_'+a.Id+'" class="reviewPointBar">'+"</div>"+"</td>"+'<td width="20" align="right">'+"<b>"+returnZeroAsNull(a.Price)+"</b>"+"</td>"+"</tr>"+"<tr>"+"<td>"+ReviewText.Food+"</td>"+"<td >"+'<div id="foodPointBar_'+a.Id+'" class="reviewPointBar">'+"</div>"+"</td>"+'<td width="20" align="right">'+"<b>"+returnZeroAsNull(a.Food)+"</b>"+"</td>"+"</tr>"+"<tr>"+"<td>"+ReviewText.Service+"</td>"+"<td>"+'<div id="servicePointBar_'+a.Id+'" class="reviewPointBar">'+"</div>"+"</td>"+'<td width="20" align="right">'+"<b>"+returnZeroAsNull(a.Services)+"</b>"+"</td>"+"</tr>"+"<tr>"+"<td>"+ReviewText.Atmosphere+"</td>"+"<td>"+'<div id="atmospherePointBar_'+a.Id+'" class="reviewPointBar">'+"</div>"+"</td>"+'<td width="20" align="right">'+"<b>"+returnZeroAsNull(a.Atmosphere)+"</b>"+"</td>"+"</tr>"+"</table>";return b}function generateRatingTooltipContent(a){var b=parseInt(a.Position)*10,c=parseInt(a.Price)*10,d=parseInt(a.Food)*10,e=parseInt(a.Services)*10,f=parseInt(a.Atmosphere)*10;$("#positionPointBar_"+a.Id).progressbar({value:b}),$("#pricePointBar_"+a.Id).progressbar({value:c}),$("#foodPointBar_"+a.Id).progressbar({value:d}),$("#servicePointBar_"+a.Id).progressbar({value:e}),$("#atmospherePointBar_"+a.Id).progressbar({value:f}),bindReviewRatingTooltipAjaxLoading(a.Id)}function generateReviewPictures(a){var b="";if(a.ReviewPictures!=null&&a.ReviewPictures.length>0){b='<div class="photos thumb review-photo">';for(var c=0;c<a.ReviewPictures.length;c++)b+='<a href="'+a.ReviewPictures[c].FullImagePath+'" class="review-img review-img-'+a.ReviewPictures[c].ReviewID+'" title="'+a.ReviewPictures[c].PictureName+'" data-id="'+a.ReviewPictures[c].RestaurantPictureID+'" data-group="1" data-size="'+a.ReviewPictures[c].Size+'" ><img alt="" src="'+a.ReviewPictures[c].FileName+'" /></a>';b+="</div>"}return b}function generateReviewShare(a){var b=encodeURIComponent("http://"+document.domain+"/"+a.RestaurantMicrositeUrl+"/binh-luan-"+a.Id),c=encodeURIComponent(a.Title+" - "+a.RestaurantName),d="";return a!=null&&(d+='<div class="share"><div class="share-left"><a href="javascript:void(0);" onclick="showCommentTextBox('+a.Id+'); return false;" ><span class="icocomment"></span><span>'+Text.Comment+'</span></a>  <a href="javascript:void(0);" reviewId="'+a.Id+'"  class="review-helpful-link" tooltip="#helpfulTooltip_'+a.Id+'" onclick="addThanks(this); return false;"><span class="icolike"></span> <span>'+ReviewText.Helpful+' (<span style="float:none;" id="totalThanks_id_'+a.Id+'">'+a.TotalReviewFavourites+"</span>)<span></a>"+'  <a class="review-report-error" reviewid="'+a.Id+'"><span class="icoreport"></span> '+ReviewText.ReportError+"</a>"+'<div id="helpfulTooltip_'+a.Id+'" class="helpfultooltip"></div>'+"</div>"+'<div class="share-right">',d+='<a href="javascript:void(0);" shareUrl="'+b+'" onclick="postToFacebookFeed(this);" reviewId="'+a.Id+'" shareName="'+c+'"><img style="display: inline; width: 16px; height: 16px" src="'+staticPath+'Scripts/social-sharing/facebook_share.png" alt="Share on Facebook" /></a>',d+=' <a href="javascript:void(0);" shareUrl="'+b+'" onclick="postToGoogleFeed(this);" reviewId="'+a.Id+'" shareName="'+c+'"><img style="display: inline;" src="'+staticPath+'Scripts/social-sharing/gplus-16.png" alt="Share on Google+" /></a>',d+=' <a href="javascript:void(0);" shareUrl="'+b+'" onclick="postToLinkedInFeed(this);" reviewId="'+a.Id+'" shareName="'+c+'"><img style="display: inline; width: 16px; height: 16px;" src="'+staticPath+'Scripts/social-sharing/linkedin.png" alt="Share on LinkedIn" /></a>',d+=' <a href="javascript:void(0);" shareUrl="'+b+'" onclick="postToTwitterFeed(this);" reviewId="'+a.Id+'" shareName="'+c+'"><img style="display: inline;" src="'+staticPath+'Scripts/social-sharing/bird_blue_16.png" alt="Share on Twitter" /></a>',d+="</div>",d+="</div>"),d}function generateReviewComments(a,b){var c="";if(a!=null){c+='<div class="review-reply" style="margin-left:0px"><div id="commentBox_'+a.ReviewID+'">',a.ShowViewAllLink&&(c+='<div class="view-all-comments"><a href="javascript:void(0);" id="view_all_comment_{0}'+a.ReviewID+'" onclick="showAllComments('+a.ReviewID+'); return false;">Hiện tất cả (<span id="comment_count_'+a.ReviewID+'">'+a.TotalComments+"</span>)</a>"+"</div>");if(a.CommentsList!=null&&a.CommentsList.length>0)for(var d=0;d<a.CommentsList.length;d++)c+=generateCommentItem(a.CommentsList[d]);c+='</div><div class="review-reply-item addcomment" id="review_comment_id_'+a.ReviewID+'"',b?a.CommentsList.length==0&&(c+='style="display:none"'):c+='style="display:none"',c+='><div class="review-reply-item-avatar"><a href="'+a.CurrentUserProfileUrl+'">'+'<img src="'+a.Avatar+'" width="30" /></a></div>'+'<div class="review-reply-item-content">'+'<textarea type="text" spellcheck="false" title="'+ReviewText.CommentWatermark+' " class="write_comment" id="write_comment_'+a.ReviewID+'" reviewId='+a.ReviewID+' onkeypress="addComment(this,event)"></textarea>'+"</div>"+"</div>"+"</div>"}return c}function generateCommentItem(a){var b="";return a!=null&&(b+='<div class="review-reply-item"><div class="review-reply-item-avatar"><a href="'+a.UserProfileUrl+'">'+'<img src="'+a.CropAvatarUrl+'" width="30" /></a></div>'+'<div class="review-reply-item-content">',a.CanDelete&&(b+='<span><a href="javascript:void(0);" commentId="'+a.CommentID+'" class="btn-close-small remove-review-comment"> x </a></span>'),b+='<a href="'+a.UserProfileUrl+'" class="user-link" refId="'+a.UserID+'" tooltip="userCommentToolTip_'+a.UserID+'" itemprop="author">'+a.UserFirstName+'</a> <span itemprop="description" style="white-space: pre-line;">'+a.Comment+"</span>"+"<br />"+'<span class="address" style="float:none; border:none;font-size:11px;" itemprop="datePublished" data-utime="'+a.PostedTimeStamp+'" title="'+formatJSONDate(a.CreatedOn)+'"></span>'+"</div>"+"</div>"),b}function generateUserCommentTooltip(a){var b="";return a!=null&&(b+='<div id="userCommentToolTip_'+a.CommentID+'" style="display:none;" class="tooltip">'+'<div class="left-arrow"><img src="'+staticPath+'Style/images/icons/arrow-left.png" alt=""/></div>'+'<div class="tooltip-left">'+'<div><img width="100px" src="'+a.AvatarUrl+'" alt=""/></div>'+"</div>"+'<div class="tooltip-right">'+'<div class="tooltip-fullname"><b>'+a.UserFullName+"</b></div>"+"<div><span>"+a.UserReviews+"</span> "+CommonText.review+"</div>"+"<div><span>"+a.UserPictures+"</span> "+CommonText.uploadphoto+"</div>"+'<div style="display:none"><span>213</span> '+CommonText.thanks+"</div>"+"</div>"+"</div>"),b}function generateUserTooltip(a){var b="";return a!=null&&(b+='<div id="userToolTip_'+a.Id+'" style="display:none;" class="tooltip">'+'<div class="left-arrow"><img src="'+staticPath+'Style/images/icons/arrow-left.png" alt=""/></div>'+'<div class="tooltip-left">'+'<div><img width="100px" src="'+a.AvatarUrl+'" alt=""/></div>'+"</div>"+'<div class="tooltip-right">'+'<div class="tooltip-fullname"><b>'+a.FullName+"</b></div>"+"<div><span>"+a.UserReviews+"</span> "+CommonText.review+"</div>"+"<div><span>"+a.UserPictures+"</span> "+CommonText.uploadphoto+"</div>"+'<div style="display:none"><span>213</span> '+CommonText.thanks+"</div>"+"</div>"+"</div>"),b}function bindUserTooltipAjaxLoading(a){$(".user-link").each(function(){addUserTooltip(this)}),$('div.review-item[reviewId="'+a+'"] .review-reply-item .comment-user-link').each(function(){addUserTooltip(this)}),$('div.reviews-main-item[reviewId="'+a+'"] .review-reply-item .comment-user-link').each(function(){addUserTooltip(this)}),$('.review-helpful-link[tooltip="#helpfulTooltip_'+a+'"]').each(function(){addHelpfulTooltip(this)})}function bindUserCommentTooltipAjaxLoading(a){a!=null&&$('.comment-user-link[tooltip="#userCommentToolTip_'+a.CommentID+'"]').each(function(){addUserTooltip(this)})}function formatJSONDate(a){var b=new Date(parseInt(a.slice(6,-2))),c=b.getDate();c<10&&(c="0"+c);var d=1+b.getMonth();return d<10&&(d="0"+d),c+"/"+d+"/"+b.getFullYear()}typeof staticPath=="undefined"&&(staticPath="")
  75. ;var RestaurantReviewsListModel=function(){var a=this;a.IsLoading=ko.observable(!1),a.ListRestaurantReviews=ko.observableArray([]),a.Current=ko.computed(function(){var b=null;for(var c=0;c<a.ListRestaurantReviews().length;c++)if(a.ListRestaurantReviews()[c].isCurrent()){b=a.ListRestaurantReviews()[c];break}return b}),a.Remove=function(b){var c=!1;for(var d=0;d<a.ListRestaurantReviews().length;d++){var e=a.ListRestaurantReviews()[d];if(e.Summary.RestaurantId==b){a.ListRestaurantReviews.remove(e);break}}},a.pushNew=function(b){var c=!1;for(var d=0;d<a.ListRestaurantReviews().length;d++){var e=a.ListRestaurantReviews()[d];if(e.Summary.RestaurantId==b){e.isCurrent(!0),c=!0;break}e.isCurrent()&&e.isCurrent(!1)}if(!c&&!a.IsLoading()){a.IsLoading(!0);var f=new Date;$.get("/Review/GetRestaurantReviews?restaurantId="+b+"&t="+f.getTime(),function(b){b.success&&a.ListRestaurantReviews.push(new RestaurantReviewsModel(b.data)),a.IsLoading(!1)})}},a.getYoutubeEmbed=function(a){return'<object width="500" height="375"><param name="movie" value="http://www.youtube.com/v/'+a.YoutubeCode+'?hl=en_US&amp;version=3;hd=1;rel=0;showinfo=0;cc_load_policy=1;showsearch=0;ap=%2526fmt%3D18"/>'+'<param name="allowFullScreen" value="true"></param>'+'<param name="allowscriptaccess" value="always"></param>'+'<embed src="http://www.youtube.com/v/'+a.YoutubeCode+'?hl=en_US&amp;version=3;autoplay=0&amp;loop=0;hd=2;rel=0;showinfo=0;cc_load_policy=1;showsearch=0;ap=%2526fmt%3D18" type="application/x-shockwave-flash" width="500" height="375" allowscriptaccess="always" allowfullscreen="true"></embed>'+"</object>"}},RestaurantReviewsModel=function(a){var b=this;b.isExcellent=ko.observable(!0),b.isGood=ko.observable(!0),b.isAverage=ko.observable(!0),b.isBad=ko.observable(!0),b.Summary=new RestaurantSummaryModel(a.Summary),b.ReviewsList=new ReviewListModel(a.ReviewsList,b),b.isCurrent=ko.observable(!0),b.ReviewsList.setUpdatedTime(5e3),b.change=function(a){switch(a){case 1:b.isExcellent(!b.isExcellent());break;case 2:b.isGood(!b.isGood());break;case 3:b.isAverage(!b.isAverage());break;case 4:b.isBad(!b.isBad())}b.ReviewsList.refresh()}},RestaurantSummaryModel=function(a){var b=this;b.RestaurantId=a.RestaurantId,b.Name=ko.observable(a.Name),b.Address=ko.observable(a.Address),b.Url=a.Url,b.PictureUrl=ko.observable(a.PictureUrl),b.TotalReviews=ko.observable(a.TotalReviews),b.TotalPerfectReviews=ko.observable(a.TotalPerfectReviews),b.TotalGoodReviews=ko.observable(a.TotalGoodReviews),b.TotalAverageReviews=ko.observable(a.TotalAverageReviews),b.TotalBadReviews=ko.observable(a.TotalBadReviews),b.AvgPoint=ko.observable(a.AvgPoint),b.writeReview=function(){isModifiedMode=!1;var a=b.RestaurantId;UploadReview.LoadAddNewReviewForm(a,function(){RestaurantReviewsModel.Remove(a),RestaurantReviewsModel.ShowPopup(a)},function(){RestaurantReviewsModel.ShowPopup(a)})}},ReviewListModel=function(a,b){var c=this;c.parent=b,c.LastId=ko.observable(a.LastId),c.RestaurantId=a.RestaurantId,c.Reviews=ko.observableArray(a.Reviews),c.TotalReviews=ko.observable(a.TotalReviews+a.TotalCheckin),c.TotalCheckin=ko.observable(a.TotalCheckin),c.fisrtTime=!0,c.Count=a.Count,c.CurrentIndex=ko.observable(1),c.IsLoadMore=ko.observable(!1),c.CurrentTimestamp=a.CurrentTimestamp,c.CurrentReview=ko.computed(function(){var a=c.CurrentIndex()-1;if(c.Reviews().length>a&&c.Reviews().length>0)return c.Reviews()[a]}),c.justChangeOption=!1,c.IsFiltering=ko.observable(!1),c.getNextPage=function(){if(!c.IsLoadMore()){c.IsLoadMore(!0);var a=c.getReviewLink();$.get(a,function(a){if(a.success){c.LastId(a.data.LastId);for(var b=0;b<a.data.Reviews.length;b++)c.Reviews.push(a.data.Reviews[b]);c.calculateCreatedTime()}c.IsLoadMore(!1)})}},c.next=function(){var a=c.CurrentIndex();c.TotalReviews()>a&&c.Reviews().length<=a&&c.getNextPage(),c.CurrentIndex()<c.TotalReviews()&&c.CurrentIndex(c.CurrentIndex()+1)},c.back=function(){c.CurrentIndex()>1&&c.CurrentIndex(c.CurrentIndex()-1)},c.getReviewLink=function(){var a=new Date,b="/review/GetMoreReviews?t="+a.getTime()+"&restaurantid="+c.RestaurantId;return c.parent.isExcellent()||(b+="&isexcellent=false"),c.parent.isGood()||(b+="&isGood=false"),c.parent.isAverage()||(b+="&isAverage=false"),c.parent.isBad()||(b+="&isBad=false"),c.LastId()>0&&(b+="&lastid="+c.LastId()),b},c.getRefreshLink=function(){var a=new Date,b="/review/GetMoreReviews?t="+a.getTime()+"&restaurantid="+c.RestaurantId;return c.parent.isExcellent()||(b+="&isexcellent=false"),c.parent.isGood()||(b+="&isGood=false"),c.parent.isAverage()||(b+="&isAverage=false"),c.parent.isBad()||(b+="&isBad=false"),b},c.refresh=ko.computed(function(){var a=c.getRefreshLink();c.fisrtTime?c.fisrtTime=!1:(c.IsLoadMore(!0),$.get(a,function(a){a.success&&(c.LastId(0),c.Reviews.removeAll(),c.Reviews(a.data.Reviews),c.TotalReviews(a.data.TotalReviews+a.data.TotalCheckin),c.TotalCheckin(a.data.TotalCheckin),c.LastId(a.data.LastId),c.CurrentIndex(1)),c.IsLoadMore(!1)}))}),c.editReview=function(a){isModifiedMode=!1;var b=a.RestaurantID,c=a.Id;UploadReview.LoadModifiedReviewForm(c,b,function(){RestaurantReviewsModel.Remove(b),RestaurantReviewsModel.ShowPopup(b)},function(){RestaurantReviewsModel.ShowPopup(b)})},c.getDiffTime=function(a){var b="";return a<60?b=CommonText.PostedTime_AFewSecondsAgo:a<120?b=CommonText.PostedTime_About1MinuteAgo:a<3600?b=Math.floor(a/60)+" "+CommonText.PostedTime_MinutesAgo:a<7200?b=CommonText.PostedTime_About1HourAgo:a<86400&&(b=Math.floor(a/3600)+" "+CommonText.PostedTime_HoursAgo),b},c.setUpdatedTime=function(a){setInterval(function(){c.CurrentTimestamp+=a/1e3,c.calculateCreatedTime()},a)},c.calculateCreatedTime=function(){var a=parseInt(c.CurrentTimestamp);$(".r-time").each(function(b,d){var e=parseInt($(this).attr("utime")),f=c.getDiffTime(a-e);f==0||f==""?$(this).text($(this).attr("title")):($(this).text(f),$(this).fadeIn())})},c.getCreatedTime=function(a){var b=parseInt(c.CurrentTimestamp),d=parseInt(a.CreatedOnTimestamp),e=c.getDiffTime(b-d);return e==0||e==""?a.CreatedOnString:e},c.getReviewDetailLink=function(a){return c.parent.Summary.Url+"/binh-luan-"+a.Id}};RestaurantReviewsModel.ShowPopup=function(a){$("#restaurant-reviews-popup").modal({persist:!0,onClose:function(a){$.modal.close()}}),$("#simplemodal-container").css("height","522px"),a&&restaurantReviewListModel.pushNew(a)},RestaurantReviewsModel.Remove=function(a){a&&restaurantReviewListModel.Remove(a)};var restaurantReviewListModel;$(function(){document.getElementById("restaurant-popup-dialog")&&(restaurantReviewListModel=new RestaurantReviewsListModel,ko.applyBindings(restaurantReviewListModel,document.getElementById("restaurant-popup-dialog")))}),$(".restaurant-reviews-link").live("click",function(){var a=$(this).attr("resid");RestaurantReviewsModel.ShowPopup(a)})
  76. ;function TopReviewOfDayModel(){var a=this;a.Position=0,a.Executing=!1,a.OrgTotalItems=0,a.IsInterval=!0,a.ContainerId,a.BtnAnimationId,a.ItemWidth,a.TotalItems,a.DisplayItems,a.DelayTime,a.MoveForward=function(b){a.Executing||(a.Executing=!0,$("#"+a.ContainerId).animate({left:(b?"-=":"+=")+a.ItemWidth+"px"},{complete:function(){b?a.Position++:a.Position--,a.Position==a.OrgTotalItems&&($("#"+a.ContainerId).css("left",-(a.ItemWidth*a.OrgTotalItems)),a.Position=0),a.Position==-1&&($("#"+a.ContainerId).css("left",-(a.ItemWidth*a.OrgTotalItems*2)),a.Position=a.OrgTotalItems-1),a.Executing=!1}}))},a.RefreshContainerWidth=function(){$("#"+a.ContainerId).width(a.ItemWidth*a.TotalItems)},a.CloneFirstLastReview=function(){var b=$("#"+a.ContainerId).html();a.TotalItems+=a.OrgTotalItems,a.RefreshContainerWidth(),$("#"+a.ContainerId).prepend(b),a.TotalItems+=a.OrgTotalItems,a.RefreshContainerWidth(),$("#"+a.ContainerId).append(b),$("#"+a.ContainerId).css("left",-(a.ItemWidth*a.OrgTotalItems))},a.Init=function(b){a.ContainerId=b.containerId,a.BtnAnimationId=b.btnAnimationId,a.ItemWidth=b.itemWidth,a.TotalItems=b.totalItems,a.OrgTotalItems=b.totalItems,a.DelayTime=b.delayTime!=null?b.delayTime:1e4,$("#"+a.ContainerId).parent().parent().hover(function(){a.IsInterval=!1},function(){a.IsInterval=!0}),$("#"+a.BtnAnimationId+"-prev").click(function(){a.MoveForward(!1)}),$("#"+a.BtnAnimationId+"-next").click(function(){a.MoveForward(!0)}),a.CloneFirstLastReview(),setInterval(function(){a.IsInterval&&a.MoveForward(!0)},a.DelayTime)}}
  77. ;(function(a){var b=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],d=["January","February","March","April","May","June","July","August","September","October","November","December"],e=[];e.Jan="01",e.Feb="02",e.Mar="03",e.Apr="04",e.May="05",e.Jun="06",e.Jul="07",e.Aug="08",e.Sep="09",e.Oct="10",e.Nov="11",e.Dec="12",a.format=function(){function a(a){return b[parseInt(a,10)]||a}function f(a){var b=parseInt(a,10)-1;return c[b]||a}function g(a){var b=parseInt(a,10)-1;return d[b]||a}var h=function(a){return e[a]||a},i=function(a){var b=a,c="";if(b.indexOf(".")!==-1){var d=b.split(".");b=d[0],c=d[1]}var e=b.split(":");return e.length===3?(hour=e[0],minute=e[1],second=e[2],{time:b,hour:hour,minute:minute,second:second,millis:c}):{time:"",hour:"",minute:"",second:"",millis:""}},j=function(a,b){var c=b-String(a).length;for(var d=0;d<c;d++)a="0"+a;return a};return{date:function(b,c){try{var d=null,e=null,k=null,l=null,m=null,n=null;if(typeof b=="number")return this.date(new Date(b),c);if(typeof b.getFullYear=="function")e=b.getFullYear(),k=b.getMonth()+1,l=b.getDate(),m=b.getDay(),n=i(b.toTimeString());else if(b.search(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d{0,3}[Z\-+]?(\d{2}:?\d{2})?/)!=-1){var o=b.split(/[T\+-]/);e=o[0],k=o[1],l=o[2],n=i(o[3].split(".")[0]),d=new Date(e,k-1,l),m=d.getDay()}else{var o=b.split(" ");switch(o.length){case 6:e=o[5],k=h(o[1]),l=o[2],n=i(o[3]),d=new Date(e,k-1,l),m=d.getDay();break;case 2:var p=o[0].split("-");e=p[0],k=p[1],l=p[2],n=i(o[1]),d=new Date(e,k-1,l),m=d.getDay();break;case 7:case 9:case 10:e=o[3],k=h(o[1]),l=o[2],n=i(o[4]),d=new Date(e,k-1,l),m=d.getDay();break;case 1:var p=o[0].split("");e=p[0]+p[1]+p[2]+p[3],k=p[5]+p[6],l=p[8]+p[9],n=i(p[13]+p[14]+p[15]+p[16]+p[17]+p[18]+p[19]+p[20]),d=new Date(e,k-1,l),m=d.getDay();break;default:return b}}var q="",r="",s="";for(var t=0;t<c.length;t++){var u=c.charAt(t);q+=u,s="";switch(q){case"ddd":r+=a(m),q="";break;case"dd":if(c.charAt(t+1)=="d")break;r+=j(l,2),q="";break;case"d":if(c.charAt(t+1)=="d")break;r+=parseInt(l,10),q="";break;case"D":l==1||l==21||l==31?l+="st":l==2||l==22?l+="nd":l==3||l==23?l+="rd":l+="th",r+=l,q="";break;case"MMMM":r+=g(k),q="";break;case"MMM":if(c.charAt(t+1)==="M")break;r+=f(k),q="";break;case"MM":if(c.charAt(t+1)=="M")break;r+=j(k,2),q="";break;case"M":if(c.charAt(t+1)=="M")break;r+=parseInt(k,10),q="";break;case"y":case"yyy":if(c.charAt(t+1)=="y")break;r+=q,q="";break;case"yy":if(c.charAt(t+1)=="y"&&c.charAt(t+2)=="y")break;r+=String(e).slice(-2),q="";break;case"yyyy":r+=e,q="";break;case"HH":r+=j(n.hour,2),q="";break;case"H":if(c.charAt(t+1)=="H")break;r+=parseInt(n.hour,10),q="";break;case"hh":var v=n.hour==0?12:n.hour<13?n.hour:n.hour-12;r+=j(v,2),q="";break;case"h":if(c.charAt(t+1)=="h")break;var v=n.hour==0?12:n.hour<13?n.hour:n.hour-12;r+=parseInt(v,10),q="";break;case"mm":r+=j(n.minute,2),q="";break;case"m":if(c.charAt(t+1)=="m")break;r+=n.minute,q="";break;case"ss":r+=j(n.second.substring(0,2),2),q="";break;case"s":if(c.charAt(t+1)=="s")break;r+=n.second,q="";break;case"S":case"SS":if(c.charAt(t+1)=="S")break;r+=q,q="";break;case"SSS":r+=n.millis.substring(0,3),q="";break;case"a":r+=n.hour>=12?"PM":"AM",q="";break;case"p":r+=n.hour>=12?"p.m.":"a.m.",q="";break;default:r+=u,q=""}}return r+=s,r}catch(w){return console.log(w),b}}}}()})(jQuery),jQuery.format.date.defaultShortDateFormat="dd/MM/yyyy",jQuery.format.date.defaultLongDateFormat="dd/MM/yyyy HH:mm:ss",jQuery(document).ready(function(){jQuery(".shortDateFormat").each(function(a,b){jQuery(b).is(":input")?jQuery(b).val(jQuery.format.date(jQuery(b).val(),jQuery.format.date.defaultShortDateFormat)):jQuery(b).text(jQuery.format.date(jQuery(b).text(),jQuery.format.date.defaultShortDateFormat))}),jQuery(".longDateFormat").each(function(a,b){jQuery(b).is(":input")?jQuery(b).val(jQuery.format.date(jQuery(b).val(),jQuery.format.date.defaultLongDateFormat)):jQuery(b).text(jQuery.format.date(jQuery(b).text(),jQuery.format.date.defaultLongDateFormat))})})
  78. ;function FixedAdsHelper(){var a=this;a.ContainerId,a.Top,a.EdgeSelector,a.Excute=function(){var b=$("#"+a.ContainerId),c=b.offset();$(window).scroll(function(){var d=a.EdgeSelector!=null?$(a.EdgeSelector).offset():null;$(window).scrollTop()>c.top&&(d==null||$(window).scrollTop()<d.top-b.height())?b.css("position","fixed").css("top",a.Top).css("left",c.left):b.css("position","static")})}}function DropDownCategoryHelper(){var a=this;a.IsHover=!1,a.CategoryId="",a.BtnCategoryId="",a.CheckHover=function(){$("#"+a.CategoryId+","+"#"+a.BtnCategoryId).hover(function(){a.IsHover=!0},function(){a.IsHover=!1}),$("body").mouseup(function(){a.IsHover||$("#"+a.CategoryId).hide()})},a.Init=function(b){a.CategoryId=b.categoryId,a.BtnCategoryId=b.btnCategoryId,$("#"+a.BtnCategoryId).click(function(){$("#"+a.CategoryId).is(":visible")?$("#"+a.CategoryId).hide():$("#"+a.CategoryId).show()}),a.CheckHover()}}var CommonHelper={ConvertJsonDate:function(a){return new Date(parseInt(a.substr(6)))},AjaxLoading:function(a,b,c){if(c==null||c=="")c="loadingImageDiv";$("#"+c).show(),a!=null&&(a.IsExecuting=!0),b!=null&&b!=""&&$("#"+b).fadeTo("slow",.3)},StopAjaxLoading:function(a,b,c){if(c==null||c=="")c="loadingImageDiv";$("#"+c).hide(),a!=null&&(a.IsExecuting=!1),b!=null&&b!=""&&$("#"+b).fadeTo("slow",1)},GetGenderEnum:function(a){switch(a){case"M":return"1";case"F":return"2";default:return"1"}},InviteFriend:function(){var a=new Date;$.ajax({type:"GET",url:"/Common/IsLogin?"+a.getTime(),success:function(a){a.success==1?window.location.href="/moi-tham-gia":LoginPopup.Show(function(){window.location.href="/moi-tham-gia"},function(){})}})},Linkify:function(a,b,c){var d={linkClass:"qa-out-link",targetBlank:!0,noFollow:!0};d=$.extend(d,c),b=b.replace(/\u200B/g,"");var e=/(name="[.\\/#a-zA-Z0-9\\(]*|id="[#a-zA-Z0-9\(]*|src="[#a-zA-Z0-9\\(]*|href="[#a-zA-Z0-9\(]*|">|\s>)?(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;ï]*[-A-Z0-9+&@#\/%=~_|ï]/gim,f=b.replace(e,function(a,b){return b?a:'<a class="'+d.linkClass+'" href="'+a+'"'+(d.targetBlank?' target="_blank"':"")+(d.noFollow?a.indexOf("www.foody.vn")!==-1?"":' rel="nofollow"':"")+">"+a+"</a>"});return f},GetSelectedTopMenu:function(a,b){a=a.toLowerCase(),b=b.toLowerCase();var c=document.URL;$(".nav-place a").each(function(){var d=$(this).attr("href"),e=$(this).data("type");d!=null&&d!=""?(d=d.toLowerCase(),c.endsWith(d)?$(this).addClass("current"):e==a&&$(this).addClass("current")):(a=="directory"||a=="restaurant")&&$(this).attr("class")=="places"&&b!="nearby"&&$(this).addClass("current")})}};$.fn.fixedAds=function(a){var b=new FixedAdsHelper,c={top:10,edgeSelector:null};a=$.extend({},c,a),b.ContainerId=this.attr("id"),b.Top=a.top,b.EdgeSelector=a.edgeSelector,b.Excute()},$.fn.doLinks=function(a,b){this.each(function(){$(this).html(CommonHelper.Linkify(a,$(this).html(),b))})},typeof String.prototype.startsWith!="function"&&(String.prototype.startsWith=function(a){return this.indexOf(a)==0}),String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1},Date.prototype.addHours=function(a){return this.setHours(this.getHours()+a),this},String.prototype.replaceAll=function(a,b){var c=this,d=c.indexOf(a);while(d!=-1)c=c.replace(a,b),d=c.indexOf(a);return c},Date.isLeapYear=function(a){return a%4===0&&a%100!==0||a%400===0},Date.getDaysInMonth=function(a,b){return[31,Date.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},Date.prototype.isLeapYear=function(){var a=this.getFullYear();return a%4===0&&a%100!==0||a%400===0},Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())},Date.prototype.addMonths=function(a){var b=this.getDate();return this.setDate(1),this.setMonth(this.getMonth()+a),this.setDate(Math.min(b,this.getDaysInMonth())),this},$.fn.addBack=function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}
  79. ;function PopupSocialEmailSharingModel(){var a=this;a.ContainerId,a.Link,a.ShowPopup=function(){$.modal.close(),$("#"+a.ContainerId).modal({persist:!0}),$("#simplemodal-container").css("width","400px"),$("#simplemodal-container").css("height","auto"),$("#simplemodal-container").css("background-color","#F9F9F9"),$(window).resize()},a.EmailSharing=function(){var b=$("#"+a.ContainerId+" form");if(b.valid()){var c={FromName:$("#FromName").val(),ToEmail:$("#ToEmail").val(),Content:$("#PopupSocialEmailSharing_Content").val(),Link:a.Link},d={emailSharing:c};$.ajax({url:"/Common/EmailSharing",data:JSON.stringify(d),type:"POST",contentType:"application/json",success:function(a){a.Message==null||a.Message==""?(alert("Cảm ơn bạn đã chia sẻ thông tin cùng bạn bè."),$.modal.close()):alert(a.Message)}})}},a.Init=function(){$("#"+a.ContainerId+" .btn-email-sharing").click(function(){a.EmailSharing()}),a.ShowPopup()}}$.fn.popupSocialEmailSharing=function(a){var b=new PopupSocialEmailSharingModel,c={};a=$.extend({},c,a),b.ContainerId=this.attr("id"),b.Link=a.link,b.Init()}
  80. ;(function(a){"use strict",a.fn.bjqs=function(b){var c={width:700,height:300,animtype:"fade",animduration:450,animspeed:4e3,automatic:!0,showcontrols:!0,centercontrols:!0,nexttext:"Next",prevtext:"Prev",showmarkers:!0,centermarkers:!0,keyboardnav:!0,hoverpause:!0,usecaptions:!0,randomstart:!1,responsive:!1},d=a.extend({},c,b),e=this,f=e.find("ul.bjqs"),g=f.children("li"),h=null,i=null,j=null,k=null,l=null,m=null,n=null,o=null,p={slidecount:g.length,animating:!1,paused:!1,currentslide:1,nextslide:0,currentindex:0,nextindex:0,interval:null},q={width:null,height:null,ratio:null},r={fwd:"forward",prev:"previous"},s=function(){g.addClass("bjqs-slide"),d.responsive?t():v(),p.slidecount>1?(d.randomstart&&C(),d.showcontrols&&x(),d.showmarkers&&y(),d.keyboardnav&&z(),d.hoverpause&&d.automatic&&A(),d.animtype==="slide"&&w()):d.automatic=!1,d.usecaptions&&B(),d.animtype==="slide"&&!d.randomstart&&(p.currentindex=1,p.currentslide=2),f.show(),g.eq(p.currentindex).show(),d.automatic&&(p.interval=setInterval(function(){E(r.fwd,!1)},d.animspeed))},t=function(){q.width=e.outerWidth(),q.ratio=q.width/d.width,q.height=d.height*q.ratio,d.animtype==="fade"&&(g.css({height:d.height,width:"100%"}),g.children("img").css({height:d.height,width:"100%"}),f.css({height:d.height,width:"100%"}),e.css({height:d.height,"max-width":d.width,position:"relative"}),q.width<d.width&&(g.css({height:q.height}),g.children("img").css({height:q.height}),f.css({height:q.height}),e.css({height:q.height})),a(window).resize(function(){q.width=e.outerWidth(),q.ratio=q.width/d.width,q.height=d.height*q.ratio,g.css({height:q.height}),g.children("img").css({height:q.height}),f.css({height:q.height}),e.css({height:q.height})})),d.animtype==="slide"&&(g.css({height:d.height,width:d.width}),g.children("img").css({height:d.height,width:d.width}),f.css({height:d.height,width:d.width*d.slidecount}),e.css({height:d.height,"max-width":d.width,position:"relative"}),q.width<d.width&&(g.css({height:q.height}),g.children("img").css({height:q.height}),f.css({height:q.height}),e.css({height:q.height})),a(window).resize(function(){q.width=e.outerWidth(),q.ratio=q.width/d.width,q.height=d.height*q.ratio,g.css({height:q.height,width:q.width}),g.children("img").css({height:q.height,width:q.width}),f.css({height:q.height,width:q.width*d.slidecount}),e.css({height:q.height}),m.css({height:q.height,width:q.width}),u(function(){E(!1,p.currentslide)},200,"some unique string")}))},u=function(){var a={};return function(b,c,d){d||(d="Don't call this twice without a uniqueId"),a[d]&&clearTimeout(a[d]),a[d]=setTimeout(b,c)}}(),v=function(){g.css({height:d.height,width:d.width}),f.css({height:d.height,width:d.width}),e.css({height:d.height,width:d.width,position:"relative"})},w=function(){n=g.eq(0).clone(),o=g.eq(p.slidecount-1).clone(),n.attr({"data-clone":"last","data-slide":0}).appendTo(f).show(),o.attr({"data-clone":"first","data-slide":0}).prependTo(f).show(),g=f.children("li"),p.slidecount=g.length,m=a('<div class="bjqs-wrapper"></div>'),d.responsive&&q.width<d.width?(m.css({width:q.width,height:q.height,overflow:"hidden",position:"relative"}),f.css({width:q.width*(p.slidecount+2),left:-q.width*p.currentslide})):(m.css({width:d.width,height:d.height,overflow:"hidden",position:"relative"}),f.css({width:d.width*(p.slidecount+2),left:-d.width*p.currentslide})),g.css({"float":"left",position:"relative",display:"list-item"}),m.prependTo(e),f.appendTo(m)},x=function(){h=a('<ul class="bjqs-controls"></ul>'),i=a('<li class="bjqs-next"><a href="#" data-direction="'+r.fwd+'">'+d.nexttext+"</a></li>"),j=a('<li class="bjqs-prev"><a href="#" data-direction="'+r.prev+'">'+d.prevtext+"</a></li>"),h.on("click","a",function(b){b.preventDefault();var c=a(this).attr("data-direction");p.animating||(c===r.fwd&&E(r.fwd,!1),c===r.prev&&E(r.prev,!1))}),j.appendTo(h),i.appendTo(h),h.appendTo(e);if(d.centercontrols){h.addClass("v-centered");var b=(e.height()-i.children("a").outerHeight())/2,c=b/d.height*100,f=c+"%";i.find("a").css("top",f),j.find("a").css("top",f)}},y=function(){k=a('<ol class="bjqs-markers"></ol>'),a.each(g,function(b,c){var e=b+1,f=b+1;d.animtype==="slide"&&(f=b+2);var g=a('<li><a href="#">'+e+"</a></li>");e===p.currentslide&&g.addClass("active-marker"),g.on("click","a",function(a){a.preventDefault(),!p.animating&&p.currentslide!==f&&E(!1,f)}),g.appendTo(k)}),k.appendTo(e),l=k.find("li");if(d.centermarkers){k.addClass("h-centered");var b=(d.width-k.width())/2;k.css("left",b)}},z=function(){a(document).keyup(function(a){p.paused||(clearInterval(p.interval),p.paused=!0),p.animating||(a.keyCode===39?(a.preventDefault(),E(r.fwd,!1)):a.keyCode===37&&(a.preventDefault(),E(r.prev,!1))),p.paused&&d.automatic&&(p.interval=setInterval(function(){E(r.fwd)},d.animspeed),p.paused=!1)})},A=function(){e.hover(function(){p.paused||(clearInterval(p.interval),p.paused=!0)},function(){typeof videoIndexModel!="undefined"?p.paused&&!videoIndexModel.IsPlayedFeaturedVideo&&(p.interval=setInterval(function(){E(r.fwd,!1)},d.animspeed),p.paused=!1):p.paused&&(p.interval=setInterval(function(){E(r.fwd,!1)},d.animspeed),p.paused=!1)})},B=function(){a.each(g,function(b,c){var d=a(c).children("img:first-child").attr("title");d||(d=a(c).children("a").find("img:first-child").attr("title")),d&&(d=a('<p class="bjqs-caption">'+d+"</p>"),d.appendTo(a(c)))})},C=function(){var a=Math.floor(Math.random()*p.slidecount)+1;p.currentslide=a,p.currentindex=a-1},D=function(a){a===r.fwd?g.eq(p.currentindex).next().length?(p.nextindex=p.currentindex+1,p.nextslide=p.currentslide+1):(p.nextindex=0,p.nextslide=1):g.eq(p.currentindex).prev().length?(p.nextindex=p.currentindex-1,p.nextslide=p.currentslide-1):(p.nextindex=p.slidecount-1,p.nextslide=p.slidecount)},E=function(a,b){if(!p.animating){p.animating=!0,b?(p.nextslide=b,p.nextindex=b-1):D(a),d.animtype==="fade"&&(d.showmarkers&&(l.removeClass("active-marker"),l.eq(p.nextindex).addClass("active-marker")),g.eq(p.currentindex).fadeOut(d.animduration),g.eq(p.nextindex).fadeIn(d.animduration,function(){p.animating=!1,p.currentslide=p.nextslide,p.currentindex=p.nextindex}));if(d.animtype==="slide"){if(d.showmarkers){var c=p.nextindex-1;c===p.slidecount-2?c=0:c===-1&&(c=p.slidecount-3),l.removeClass("active-marker"),l.eq(c).addClass("active-marker")}d.responsive&&q.width<d.width?p.slidewidth=q.width:p.slidewidth=d.width,f.animate({left:-p.nextindex*p.slidewidth},d.animduration,function(){p.currentslide=p.nextslide,p.currentindex=p.nextindex,g.eq(p.currentindex).attr("data-clone")==="last"?(f.css({left:-p.slidewidth}),p.currentslide=2,p.currentindex=1):g.eq(p.currentindex).attr("data-clone")==="first"&&(f.css({left:-p.slidewidth*(p.slidecount-2)}),p.currentslide=p.slidecount-1,p.currentindex=p.slidecount-2),p.animating=!1})}}};s()}})(jQuery)
  81. ;function ShowBrandReward(a){rewardProccessModel.resultModel(null),rewardProccessModel.showRewardInfo(a)}function ShowRewardApplyResult(a){rewardProccessModel.submitModel(null),rewardProccessModel.showRewardResultInfo(a)}function ShowRewardIntro(a){$("#brand-reward-popup").modal({persist:!0}),rewardProccessModel.resultModel(null),rewardProccessModel.showRewardIntro(a)}function ShowSelectBanner(){$.modal.close(),$("#brand-reward-popup").modal({persist:!0}),rewardProccessModel.showBanners()}var WinnersModel=function(a){var b=this;b.winners=ko.observableArray(a.Winners),b.count=a.Count,b.lastId=a.LastId,b.total=a.TotalResult,b.totalRemaining=a.TotalResult-a.Count},UserResultInfoModel=function(a){var b=this;b.firstName=ko.observable(a.FirstName),b.lastName=ko.observable(a.LastName),b.userId=ko.observable(a.UserId),b.bannerId=ko.observable(a.BannerId),b.isWin=ko.observable(a.IsWin),b.prize=ko.observable(a.Prize),b.totalTriesText=ko.observable(a.TotalTriesText)},UserSubmitInfoModel=function(a){var b=this;b.firstName=ko.observable(a.FirstName),b.lastName=ko.observable(a.LastName),b.userId=ko.observable(a.UserId),b.address=ko.observable(a.Address),b.phone=ko.observable(a.Phone),b.email=ko.observable(a.Email),b.bannerId=ko.observable(a.BannerId),b.hasEmail=a.HasEmail,b.totalTriesText=ko.observable(a.TotalTriesText),b.firstNameValid=ko.computed(function(){return b.firstName()!=null&&$.trim(b.firstName())!=""}),b.lastNameValid=ko.computed(function(){return b.lastName()!=null&&$.trim(b.lastName())!=""}),b.addressValid=ko.computed(function(){return b.address()!=null&&$.trim(b.address())!=""}),b.phoneValid=ko.computed(function(){return b.phone()!=null&&$.trim(b.phone())!=""}),b.emailValid=ko.computed(function(){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,c=!0;return a.test(b.email())||(c=!1),b.email()!=null&&$.trim(b.email())!=""&&c}),b.issubmiting=ko.observable(!1),b.submit=function(){if(!b.issubmiting()){b.issubmiting(!0);if(b.firstNameValid()&&b.lastNameValid()&&b.addressValid()&&b.phoneValid()&&(b.hasEmail||!b.hasEmail&&b.emailValid())){var a={FirstName:b.firstName(),LastName:b.lastName(),UserId:b.userId(),Address:b.address(),Phone:b.phone(),Email:b.email(),BannerId:b.bannerId()};$.ajax({type:"POST",url:"/Reward/BrandRewardUserSubmit",data:a,success:function(a){a.success?(ShowRewardApplyResult(a.data),b.issubmiting(!1)):(a.errorCode==12&&alert(ErrorText.Email_Exist),b.issubmiting(!1))}})}}}},BrandRewardSubmitModel=function(a){var b=this;a.Prizes!=null&&(b.prizes=ko.observableArray(a.Prizes)),b.bannerInfo=ko.observable(a.BannerInfo),a.Winners!=null&&(b.winners=ko.observable(new WinnersModel(a.Winners))),a.User!=null&&(b.user=ko.observable(new UserSubmitInfoModel(a.User))),b.isLoading=ko.observable(!1)},BrandRewardApplyResultModel=function(a){var b=this;b.prizes=ko.observableArray(a.Prizes),b.bannerInfo=ko.observable(a.BannerInfo),b.winners=ko.observable(new WinnersModel(a.Winners)),b.user=ko.observable(new UserResultInfoModel(a.User)),b.isLoading=ko.observable(!1)},BrandRewardProcessModel=function(){var a=this;a.submitModel=ko.observable(null),a.resultModel=ko.observable(null),a.isLoading=ko.observable(!1),a.hasError=ko.observable(!1),a.errorText=ko.observable(""),a.template=ko.observable("1"),a.isMaxTries=ko.observable(!1),a.showRewardInfo=function(b){a.isShowSelectedBanner(!1),a.Login(function(){$("#brand-reward-popup").modal({persist:!0}),a.isShowIntro(!1),a.submitModel(null),a.hasError(!1),a.errorText(""),a.isMaxTries(!1);if(!a.isLoading()){a.isLoading(!0);var c=new Date;$.get("/reward/GetRewardInfo/"+b+"?d="+c.getTime(),function(b){a.template(b.template),b.success?(a.submitModel(new BrandRewardSubmitModel(b.data)),$("#simplemodal-container").css("height","424px"),$(window).resize(),a.isLoading(!1)):(a.isLoading(!1),b.errorCode==9&&(a.hasError(!0),a.isMaxTries(!0),a.submitModel(new BrandRewardSubmitModel(b.data))))})}})},a.showRewardResultInfo=function(b){a.isShowSelectedBanner(!1);if(!a.isLoading()){a.isLoading(!0);var c=new Date;$.get("/reward/GetRewardResult?transId="+b+"&d="+c.getTime(),function(b){b.success?(a.template(b.data.Template),a.resultModel(new BrandRewardApplyResultModel(b.data)),a.isLoading(!1)):(a.isLoading(!1),a.hasError(!0))})}},a.isShowIntro=ko.observable(!1),a.bannerInfo=ko.observable(),a.showRewardIntro=function(b){a.isShowSelectedBanner(!1);if(!a.isLoading()){a.isLoading(!0);var c=new Date;$.get("/reward/GetBannerInfo/"+b+"?d="+c.getTime(),function(b){b.success?(a.template(b.data.Template),a.bannerInfo(b.data),a.isShowIntro(!0),a.isLoading(!1)):a.isLoading(!1)})}},a.goToReward=function(b,c){a.bannerInfo&&a.showRewardInfo(a.bannerInfo().Id)},a.Login=function(a){var b=new Date;$.ajax({type:"GET",url:"/Common/IsLogin?"+b.getTime(),success:function(b){b.success==1?a():LoginPopup.Show(function(){$.modal.close(),a()},function(){})}})},a.banners=ko.observableArray([]),a.isShowSelectedBanner=ko.observable(!0),a.showBanners=function(){if(!a.isLoading()){a.isLoading(!0);var b=new Date;$.get("/reward/GetClickBanners?t="+b.getTime(),function(b){a.isShowSelectedBanner(!0),a.banners(b.data),a.isLoading(!1)})}},a.bannerClick=function(b){a.showRewardInfo(b.Id)},a.retry=function(){ShowBrandReward(a.resultModel().bannerInfo().Id)}},rewardProccessModel=new BrandRewardProcessModel;$(function(){$("#banner-list").bjqs({height:250,width:300,responsive:!0,showmarkers:!0,centermarkers:!0,showcontrols:!1,centercontrols:!1,animduration:1e3,animspeed:4e3}),$("#get-reward-proccess").length&&ko.applyBindings(rewardProccessModel,document.getElementById("get-reward-proccess"));if(window.location.hash.indexOf("#clickbanner-")==0){var a=parseInt(window.location.hash.substr(13,window.location.hash.length-13));a>0&&ShowRewardIntro(a)}$(".banner-select").click(function(){ShowSelectBanner()}),$(".home-right-ads").each(function(){$(this).bjqs({height:250,width:300,responsive:!0,showmarkers:!1,centermarkers:!0,showcontrols:!1,centercontrols:!1,animduration:1e3,animspeed:4e3})})}),$(".brand-reward").live("click",function(){var a=$(this).attr("refid");ShowBrandReward(a)})
  82. ;(function(a){function b(a){var b={};if(a.selectionStart===undefined){a.focus();var c=document.selection.createRange();b.length=c.text.length,c.moveStart("character",-a.value.length),b.end=c.text.length,b.start=b.end-b.length}else b.start=a.selectionStart,b.end=a.selectionEnd,b.length=b.end-b.start;return b}function c(a,b,c){if(a.selectionStart===undefined){a.focus();var d=a.createTextRange();d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d.select()}else a.selectionStart=b,a.selectionEnd=c}function d(b,c){a.each(c,function(a,d){typeof d=="function"?c[a]=d(b,c,a):typeof b.autoNumeric[d]=="function"&&(c[a]=b.autoNumeric[d](b,c,a))})}function e(a,b){typeof a[b]=="string"&&(a[b]*=1)}function f(a,b){d(a,b),b.oEvent=null,b.tagList=["B","CAPTION","CITE","CODE","DD","DEL","DIV","DFN","DT","EM","H1","H2","H3","H4","H5","H6","INS","KDB","LABEL","LI","OUTPUT","P","Q","S","SAMPLE","SPAN","STRONG","TD","TH","U","VAR"];var c=b.vMax.toString().split("."),f=!b.vMin&&b.vMin!==0?[]:b.vMin.toString().split(".");e(b,"vMax"),e(b,"vMin"),e(b,"mDec"),b.allowLeading=!0,b.aNeg=b.vMin<0?"-":"",c[0]=c[0].replace("-",""),f[0]=f[0].replace("-",""),b.mInt=Math.max(c[0].length,f[0].length,1);if(b.mDec===null){var g=0,h=0;c[1]&&(g=c[1].length),f[1]&&(h=f[1].length),b.mDec=Math.max(g,h)}b.altDec===null&&b.mDec>0&&(b.aDec==="."&&b.aSep!==","?b.altDec=",":b.aDec===","&&b.aSep!=="."&&(b.altDec="."));var i=b.aNeg?"([-\\"+b.aNeg+"]?)":"(-?)";b.aNegRegAutoStrip=i,b.skipFirstAutoStrip=new RegExp(i+"[^-"+(b.aNeg?"\\"+b.aNeg:"")+"\\"+b.aDec+"\\d]"+".*?(\\d|\\"+b.aDec+"\\d)"),b.skipLastAutoStrip=new RegExp("(\\d\\"+b.aDec+"?)[^\\"+b.aDec+"\\d]\\D*$");var j="-"+b.aNum+"\\"+b.aDec;return b.allowedAutoStrip=new RegExp("[^"+j+"]","gi"),b.numRegAutoStrip=new RegExp(i+"(?:\\"+b.aDec+"?(\\d+\\"+b.aDec+"\\d+)|(\\d*(?:\\"+b.aDec+"\\d*)?))"),b}function g(a,b,c){if(b.aSign)while(a.indexOf(b.aSign)>-1)a=a.replace(b.aSign,"");a=a.replace(b.skipFirstAutoStrip,"$1$2"),a=a.replace(b.skipLastAutoStrip,"$1"),a=a.replace(b.allowedAutoStrip,""),b.altDec&&(a=a.replace(b.altDec,b.aDec));var d=a.match(b.numRegAutoStrip);a=d?[d[1],d[2],d[3]].join(""):"";if((b.lZero==="allow"||b.lZero==="keep")&&c!=="strip"){var e=[],f="";e=a.split(b.aDec),e[0].indexOf("-")!==-1&&(f="-",e[0]=e[0].replace("-","")),e[0].length>b.mInt&&e[0].charAt(0)==="0"&&(e[0]=e[0].slice(1)),a=f+e.join(b.aDec)}if(c&&b.lZero==="deny"||c&&b.lZero==="allow"&&b.allowLeading===!1){var g="^"+b.aNegRegAutoStrip+"0*(\\d"+(c==="leading"?")":"|$)");g=new RegExp(g),a=a.replace(g,"$1$2")}return a}function h(a,b,c){return b=b.split(","),c==="set"||c==="focusout"?(a=a.replace("-",""),a=b[0]+a+b[1]):(c==="get"||c==="focusin"||c==="pageLoad")&&a.charAt(0)===b[0]&&(a=a.replace(b[0],"-"),a=a.replace(b[1],"")),a}function i(a,b,c){if(b&&c){var d=a.split(b);d[1]&&d[1].length>c&&(c>0?(d[1]=d[1].substring(0,c),a=d.join(b)):a=d[0])}return a}function j(a,b,c){return b&&b!=="."&&(a=a.replace(b,".")),c&&c!=="-"&&(a=a.replace(c,"-")),a.match(/\d/)||(a+="0"),a}function k(a,b){var c=a.indexOf("."),d=+a;if(c!==-1)if(d<1e-6&&d>-1)a=+a,a<1e-6&&a>0&&(a=(a+10).toString(),a=a.substring(1)),a<0&&a>-1&&(a=(a-10).toString(),a="-"+a.substring(2)),a=a.toString();else{var e=a.split(".");e[1]!==undefined&&(+e[1]===0?a=e[0]:(e[1]=e[1].replace(/0*$/,""),a=e.join(".")))}return b.lZero==="keep"?a:a.replace(/^0*(\d)/,"$1")}function l(a,b,c){return c&&c!=="-"&&(a=a.replace("-",c)),b&&b!=="."&&(a=a.replace(".",b)),a}function m(b,c){b=g(b,c),b=i(b,c.aDec,c.mDec),b=j(b,c.aDec,c.aNeg);var d=+b;return c.oEvent==="set"&&(d<c.vMin||d>c.vMax)&&a.error("The value ("+d+") from the 'set' method falls outside of the vMin / vMax range"),d>=c.vMin&&d<=c.vMax}function n(a,b,c){return a===""||a===b.aNeg?b.wEmpty==="zero"?a+"0":b.wEmpty==="sign"||c?a+b.aSign:a:null}function o(a,b){a=g(a,b);var c=a.replace(",","."),d=n(a,b,!0);if(d!==null)return d;var e="";b.dGroup===2?e=/(\d)((\d)(\d{2}?)+)$/:b.dGroup===4?e=/(\d)((\d{4}?)+)$/:e=/(\d)((\d{3}?)+)$/;var f=a.split(b.aDec);b.altDec&&f.length===1&&(f=a.split(b.altDec));var i=f[0];if(b.aSep)while(e.test(i))i=i.replace(e,"$1"+b.aSep+"$2");b.mDec!==0&&f.length>1?(f[1].length>b.mDec&&(f[1]=f[1].substring(0,b.mDec)),a=i+b.aDec+f[1]):a=i;if(b.aSign){var j=a.indexOf(b.aNeg)!==-1;a=a.replace(b.aNeg,""),a=b.pSign==="p"?b.aSign+a:a+b.aSign,j&&(a=b.aNeg+a)}return b.oEvent==="set"&&c<0&&b.nBracket!==null&&(a=h(a,b.nBracket,b.oEvent)),a}function p(a,b){a=a===""?"0":a.toString(),e(b,"mDec");var c="",d=0,f="",g=typeof b.aPad=="boolean"||b.aPad===null?b.aPad?b.mDec:0:+b.aPad,h=function(a){var b=g===0?/(\.[1-9]*)0*$/:g===1?/(\.\d[1-9]*)0*$/:new RegExp("(\\.\\d{"+g+"}[1-9]*)0*$");return a=a.replace(b,"$1"),g===0&&(a=a.replace(/\.$/,"")),a};a.charAt(0)==="-"&&(f="-",a=a.replace("-","")),a.match(/^\d/)||(a="0"+a),f==="-"&&+a===0&&(f="");if(+a>0&&b.lZero!=="keep"||a.length>0&&b.lZero==="allow")a=a.replace(/^0*(\d)/,"$1");var i=a.lastIndexOf("."),j=i===-1?a.length-1:i,k=a.length-1-j;if(k<=b.mDec){c=a;if(k<g){i===-1&&(c+=".");while(k<g){var l="000000".substring(0,g-k);c+=l,k+=l.length}}else k>g?c=h(c):k===0&&g===0&&(c=c.replace(/\.$/,""));return f+c}var m=i+b.mDec,n=+a.charAt(m+1),o=a.substring(0,m+1).split(""),p=a.charAt(m)==="."?a.charAt(m-1)%2:a.charAt(m)%2;if(n>4&&b.mRound==="S"||n>4&&b.mRound==="A"&&f===""||n>5&&b.mRound==="A"&&f==="-"||n>5&&b.mRound==="s"||n>5&&b.mRound==="a"&&f===""||n>4&&b.mRound==="a"&&f==="-"||n>5&&b.mRound==="B"||n===5&&b.mRound==="B"&&p===1||n>0&&b.mRound==="C"&&f===""||n>0&&b.mRound==="F"&&f==="-"||n>0&&b.mRound==="U")for(d=o.length-1;d>=0;d-=1)if(o[d]!=="."){o[d]=+o[d]+1;if(o[d]<10)break;d>0&&(o[d]="0")}return o=o.slice(0,m+1),c=h(o.join("")),+c===0?c:f+c}function q(b,c){this.settings=c,this.that=b,this.$that=a(b),this.formatted=!1,this.settingsClone=f(this.$that,this.settings),this.value=b.value}function r(b){return typeof b=="string"&&(b=b.replace(/\[/g,"\\[").replace(/\]/g,"\\]"),b="#"+b.replace(/(:|\.)/g,"\\$1")),a(b)}function s(a,b,c){var d=a.data("autoNumeric");d||(d={},a.data("autoNumeric",d));var e=d.holder;if(e===undefined&&b||c)e=new q(a.get(0),b),d.holder=e;return e}"use strict",q.prototype={init:function(a){this.value=this.that.value,this.settingsClone=f(this.$that,this.settings),this.ctrlKey=a.ctrlKey,this.cmdKey=a.metaKey,this.shiftKey=a.shiftKey,this.selection=b(this.that);if(a.type==="keydown"||a.type==="keyup")this.kdCode=a.keyCode;this.which=a.which,this.processed=!1,this.formatted=!1},setSelection:function(a,b,d){a=Math.max(a,0),b=Math.min(b,this.that.value.length),this.selection={start:a,end:b,length:b-a},(d===undefined||d)&&c(this.that,a,b)},setPosition:function(a,b){this.setSelection(a,a,b)},getBeforeAfter:function(){var a=this.value,b=a.substring(0,this.selection.start),c=a.substring(this.selection.end,a.length);return[b,c]},getBeforeAfterStriped:function(){var a=this.getBeforeAfter();return a[0]=g(a[0],this.settingsClone),a[1]=g(a[1],this.settingsClone),a},normalizeParts:function(a,b){var c=this.settingsClone;b=g(b,c);var d=b.match(/^\d/)?!0:"leading";a=g(a,c,d),(a===""||a===c.aNeg)&&c.lZero==="deny"&&b>""&&(b=b.replace(/^0*(\d)/,"$1"));var e=a+b;if(c.aDec){var f=e.match(new RegExp("^"+c.aNegRegAutoStrip+"\\"+c.aDec));f&&(a=a.replace(f[1],f[1]+"0"),e=a+b)}return c.wEmpty==="zero"&&(e===c.aNeg||e==="")&&(a+="0"),[a,b]},setValueParts:function(a,b){var c=this.settingsClone,d=this.normalizeParts(a,b),e=d.join(""),f=d[0].length;return m(e,c)?(e=i(e,c.aDec,c.mDec),f>e.length&&(f=e.length),this.value=e,this.setPosition(f,!1),!0):!1},signPosition:function(){var a=this.settingsClone,b=a.aSign,c=this.that;if(b){var d=b.length;if(a.pSign==="p"){var e=a.aNeg&&c.value&&c.value.charAt(0)===a.aNeg;return e?[1,d+1]:[0,d]}var f=c.value.length;return[f-d,f]}return[1e3,-1]},expandSelectionOnSign:function(a){var b=this.signPosition(),c=this.selection;c.start<b[1]&&c.end>b[0]&&((c.start<b[0]||c.end>b[1])&&this.value.substring(Math.max(c.start,b[0]),Math.min(c.end,b[1])).match(/^\s*$/)?c.start<b[0]?this.setSelection(c.start,b[0],a):this.setSelection(b[1],c.end,a):this.setSelection(Math.min(c.start,b[0]),Math.max(c.end,b[1]),a))},checkPaste:function(){if(this.valuePartsBeforePaste!==undefined){var a=this.getBeforeAfter(),b=this.valuePartsBeforePaste;delete this.valuePartsBeforePaste,a[0]=a[0].substr(0,b[0].length)+g(a[0].substr(b[0].length),this.settingsClone),this.setValueParts(a[0],a[1])||(this.value=b.join(""),this.setPosition(b[0].length,!1))}},skipAllways:function(a){var b=this.kdCode,c=this.which,d=this.ctrlKey,e=this.cmdKey,f=this.shiftKey;if((d||e)&&a.type==="keyup"&&this.valuePartsBeforePaste!==undefined||f&&b===45)return this.checkPaste(),!1;if(b>=112&&b<=123||b>=91&&b<=93||b>=9&&b<=31||b<8&&(c===0||c===b)||b===144||b===145||b===45)return!0;if((d||e)&&b===65)return!0;if(!d&&!e||b!==67&&b!==86&&b!==88){if(d||e)return!0;if(b===37||b===39){var g=this.settingsClone.aSep,h=this.selection.start,i=this.that.value;return a.type==="keydown"&&g&&!this.shiftKey&&(b===37&&i.charAt(h-2)===g?this.setPosition(h-1):b===39&&i.charAt(h+1)===g&&this.setPosition(h+1)),!0}return b>=34&&b<=40?!0:!1}a.type==="keydown"&&this.expandSelectionOnSign();if(b===86||b===45)a.type==="keydown"||a.type==="keypress"?this.valuePartsBeforePaste===undefined&&(this.valuePartsBeforePaste=this.getBeforeAfter()):this.checkPaste();return a.type==="keydown"||a.type==="keypress"||b===67},processAllways:function(){var a;return this.kdCode===8||this.kdCode===46?(this.selection.length?(this.expandSelectionOnSign(!1),a=this.getBeforeAfterStriped(),this.setValueParts(a[0],a[1])):(a=this.getBeforeAfterStriped(),this.kdCode===8?a[0]=a[0].substring(0,a[0].length-1):a[1]=a[1].substring(1,a[1].length),this.setValueParts(a[0],a[1])),!0):!1},processKeypress:function(){var a=this.settingsClone,b=String.fromCharCode(this.which),c=this.getBeforeAfterStriped(),d=c[0],e=c[1];return b===a.aDec||a.altDec&&b===a.altDec||(b==="."||b===",")&&this.kdCode===110?!a.mDec||!a.aDec?!0:a.aNeg&&e.indexOf(a.aNeg)>-1?!0:d.indexOf(a.aDec)>-1?!0:e.indexOf(a.aDec)>0?!0:(e.indexOf(a.aDec)===0&&(e=e.substr(1)),this.setValueParts(d+a.aDec,e),!0):b==="-"||b==="+"?a.aNeg?(d===""&&e.indexOf(a.aNeg)>-1&&(d=a.aNeg,e=e.substring(1,e.length)),d.charAt(0)===a.aNeg?d=d.substring(1,d.length):d=b==="-"?a.aNeg+d:d,this.setValueParts(d,e),!0):!0:b>="0"&&b<="9"?(a.aNeg&&d===""&&e.indexOf(a.aNeg)>-1&&(d=a.aNeg,e=e.substring(1,e.length)),a.vMax<=0&&a.vMin<a.vMax&&this.value.indexOf(a.aNeg)===-1&&b!=="0"&&(d=a.aNeg+d),this.setValueParts(d+b,e),!0):!0},formatQuick:function(){var a=this.settingsClone,b=this.getBeforeAfterStriped(),c=this.value;if((a.aSep===""||a.aSep!==""&&c.indexOf(a.aSep)===-1)&&(a.aSign===""||a.aSign!==""&&c.indexOf(a.aSign)===-1)){var d=[],e="";d=c.split(a.aDec),d[0].indexOf("-")>-1&&(e="-",d[0]=d[0].replace("-",""),b[0]=b[0].replace("-","")),d[0].length>a.mInt&&b[0].charAt(0)==="0"&&(b[0]=b[0].slice(1)),b[0]=e+b[0]}var f=o(this.value,this.settingsClone),g=f.length;if(f){var h=b[0].split(""),i=0;for(i;i<h.length;i+=1)h[i].match("\\d")||(h[i]="\\"+h[i]);var j=new RegExp("^.*?"+h.join(".*?")),k=f.match(j);k?(g=k[0].length,(g===0&&f.charAt(0)!==a.aNeg||g===1&&f.charAt(0)===a.aNeg)&&a.aSign&&a.pSign==="p"&&(g=this.settingsClone.aSign.length+(f.charAt(0)==="-"?1:0))):a.aSign&&a.pSign==="s"&&(g-=a.aSign.length)}this.that.value=f,this.setPosition(g),this.formatted=!0}};var t={init:function(b){return this.each(function(){var d=a(this),e=d.data("autoNumeric"),f=d.data();if(typeof e=="object")return this;var i={aNum:"0123456789",aSep:",",dGroup:"3",aDec:".",altDec:null,aSign:"",pSign:"p",vMax:"999999999.99",vMin:"0.00",mDec:null,mRound:"S",aPad:!0,nBracket:null,wEmpty:"empty",lZero:"allow",aForm:!0,onSomeEvent:function(){}};e=a.extend({},i,f,b);if(e.aDec===e.aSep)return a.error("autoNumeric will not function properly when the decimal character aDec: '"+e.aDec+"' and thousand separator aSep: '"+e.aSep+"' are the same character"),this;d.data("autoNumeric",e),e.lastSetValue="",e.runOnce=!1;var k=s(d,e);if(a.inArray(d.prop("tagName"),e.tagList)===-1&&d.prop("tagName")!=="INPUT")return a.error("The <"+d.prop("tagName")+"> is not supported by autoNumeric()"),this;if(e.runOnce===!1&&e.aForm){if(d.is("input[type=text], input[type=hidden], input:not([type])")){var q=!0;d[0].value===""&&e.wEmpty==="empty"&&(d[0].value="",q=!1),d[0].value===""&&e.wEmpty==="sign"&&(d[0].value=e.aSign,q=!1),q&&d.autoNumeric("set",d.val())}a.inArray(d.prop("tagName"),e.tagList)!==-1&&d.text()!==""&&d.autoNumeric("set",d.text())}e.runOnce=!0,d.is("input[type=text], input[type=hidden], input:not([type])")&&(d.on("keydown.autoNumeric",function(b){return k=s(d),k.settings.aDec===k.settings.aSep?(a.error("autoNumeric will not function properly when the decimal character aDec: '"+k.settings.aDec+"' and thousand separator aSep: '"+k.settings.aSep+"' are the same character"),this):k.that.readOnly?(k.processed=!0,!0):(k.init(b),k.settings.oEvent="keydown",k.skipAllways(b)?(k.processed=!0,!0):k.processAllways()?(k.processed=!0,k.formatQuick(),b.preventDefault(),!1):(k.formatted=!1,!0))}),d.on("keypress.autoNumeric",function(a){var b=s(d),c=b.processed;b.init(a),b.settings.oEvent="keypress";if(b.skipAllways(a))return!0;if(c)return a.preventDefault(),!1;if(b.processAllways()||b.processKeypress())return b.formatQuick(),a.preventDefault(),!1;b.formatted=!1}),d.on("keyup.autoNumeric",function(a){var b=s(d);b.init(a),b.settings.oEvent="keyup";var e=b.skipAllways(a);b.kdCode=0,delete b.valuePartsBeforePaste,d[0].value===b.settings.aSign&&(b.settings.pSign==="s"?c(this,0,0):c(this,b.settings.aSign.length,b.settings.aSign.length));if(e)return!0;if(this.value==="")return!0;b.formatted||b.formatQuick()}),d.on("focusin.autoNumeric",function(){var a=s(d);a.settingsClone.oEvent="focusin";if(a.settingsClone.nBracket!==null){var b=d.val();d.val(h(b,a.settingsClone.nBracket,a.settingsClone.oEvent))}a.inVal=d.val();var e=n(a.inVal,a.settingsClone,!0);e!==null&&(d.val(e),a.settings.pSign==="s"?c(this,0,0):c(this,a.settings.aSign.length,a.settings.aSign.length))}),d.on("focusout.autoNumeric",function(){var a=s(d),b=a.settingsClone,c=d.val(),e=c;a.settingsClone.oEvent="focusout";var f="";b.lZero==="allow"&&(b.allowLeading=!1,f="leading"),c!==""&&(c=g(c,b,f),n(c,b)===null&&m(c,b,d[0])?(c=j(c,b.aDec,b.aNeg),c=p(c,b),c=l(c,b.aDec,b.aNeg)):c="");var i=n(c,b,!1);i===null&&(i=o(c,b)),i!==e&&d.val(i),i!==a.inVal&&(d.change(),delete a.inVal),b.nBracket!==null&&d.autoNumeric("get")<0&&(a.settingsClone.oEvent="focusout",d.val(h(d.val(),b.nBracket,b.oEvent)))}))})},destroy:function(){return a(this).each(function(){var b=a(this);b.off(".autoNumeric"),b.removeData("autoNumeric")})},update:function(b){return a(this).each(function(){var c=r(a(this)),d=c.data("autoNumeric");if(typeof d!="object")return a.error("You must initialize autoNumeric('init', {options}) prior to calling the 'update' method"),this;var e=c.autoNumeric("get");d=a.extend(d,b),s(c,d,!0);if(d.aDec===d.aSep)return a.error("autoNumeric will not function properly when the decimal character aDec: '"+d.aDec+"' and thousand separator aSep: '"+d.aSep+"' are the same character"),this;c.data("autoNumeric",d);if(c.val()!==""||c.text()!=="")return c.autoNumeric("set",e);return})},set:function(b){return a(this).each(function(){var c=r(a(this)),d=c.data("autoNumeric"),e=b.toString(),f=b.toString();return typeof d!="object"?(a.error("You must initialize autoNumeric('init', {options}) prior to calling the 'set' method"),this):(f===c.attr("value")&&(e=e.replace(",",".")),f!==c.attr("value")&&d.runOnce===!1&&(e=g(e,d)),a.isNumeric(+e)?(e=k(e,d),d.oEvent="set",d.lastSetValue=e,e.toString(),e!==""&&(e=p(e,d)),e=l(e,d.aDec,d.aNeg),m(e,d)||(e=p("",d)),e=o(e,d),c.is("input[type=text], input[type=hidden], input:not([type])")?c.val(e):a.inArray(c.prop("tagName"),d.tagList)!==-1?c.text(e):(a.error("The <"+c.prop("tagName")+"> is not supported by autoNumeric()"),!1)):"")})},get:function(){var b=r(a(this)),c=b.data("autoNumeric");if(typeof c!="object")return a.error("You must initialize autoNumeric('init', {options}) prior to calling the 'get' method"),this;c.oEvent="get";var d="";if(b.is("input[type=text], input[type=hidden], input:not([type])"))d=b.eq(0).val();else if(a.inArray(b.prop("tagName"),c.tagList)!==-1)d=b.eq(0).text();else return a.error("The <"+b.prop("tagName")+"> is not supported by autoNumeric()"),!1;if(d===""&&c.wEmpty==="empty"||d===c.aSign&&(c.wEmpty==="sign"||c.wEmpty==="empty"))return"";c.nBracket!==null&&d!==""&&(d=h(d,c.nBracket,c.oEvent));if(c.runOnce||c.aForm===!1)d=g(d,c);return d=j(d,c.aDec,c.aNeg),+d===0&&c.lZero!=="keep"&&(d="0"),c.lZero==="keep"?d:(d=k(d,c),d)},getString:function(){var b=!1,c=r(a(this)),d=c.serialize(),e=d.split("&"),f=0;for(f;f<e.length;f+=1){var g=e[f].split("="),h=a('*[name="'+decodeURIComponent(g[0])+'"]').data("autoNumeric");typeof h=="object"&&g[1]!==null&&a('*[name="'+decodeURIComponent(g[0])+'"]').data("autoNumeric")!==undefined&&(g[1]=a('input[name="'+decodeURIComponent(g[0])+'"]').autoNumeric("get"),e[f]=g.join("="),b=!0)}return b===!0?e.join("&"):(a.error("You must initialize autoNumeric('init', {options}) prior to calling the 'getString' method"),this)},getArray:function(){var b=!1,c=r(a(this)),d=c.serializeArray();return a.each(d,function(c,d){var e=a('*[name="'+decodeURIComponent(d.name)+'"]').data("autoNumeric");typeof e=="object"&&(d.value!==""&&a('*[name="'+decodeURIComponent(d.name)+'"]').data("autoNumeric")!==undefined&&(d.value=a('input[name="'+decodeURIComponent(d.name)+'"]').autoNumeric("get").toString()),b=!0)}),b===!0?d:(a.error("You must initialize autoNumeric('init', {options}) prior to calling the 'getArray' method"),this)},getSettings:function(){var b=r(a(this));return b.eq(0).data("autoNumeric")}};a.fn.autoNumeric=function(b){if(t[b])return t[b].apply(this,Array.prototype.slice.call(arguments,1));if(typeof b=="object"||!b)return t.init.apply(this,arguments);a.error('Method "'+b+'" is not supported by autoNumeric()')}})(jQuery)
  83. ;function ShowEvent(a){eventPopupModel.load(a)}var EventRegisteredUser=function(a){var b=this;b.firstName=ko.observable(a.FirstName),b.lastName=ko.observable(a.LastName),b.userId=ko.observable(a.UserId),b.address=ko.observable(a.Address),b.phone=ko.observable(a.Phone),b.email=ko.observable(a.Email),b.bannerId=ko.observable(a.BannerId),b.hasEmail=a.HasEmail,b.totalTriesText=ko.observable(a.TotalTriesText),b.cityId=ko.observable(a.CityId),b.districtId=ko.observable(a.DistrictId),b.eventId=ko.observable(a.EventId),b.poolId=ko.observable(0),b.provinces=ko.observableArray(a.Provinces),b.districts=ko.observableArray(a.Districts),b.firstNameValid=ko.computed(function(){return b.firstName()!=null&&$.trim(b.firstName())!=""}),b.lastNameValid=ko.computed(function(){return b.lastName()!=null&&$.trim(b.lastName())!=""}),b.addressValid=ko.computed(function(){return b.address()!=null&&$.trim(b.address())!=""}),b.phoneValid=ko.computed(function(){return b.phone()!=null&&$.trim(b.phone())!=""}),b.districtValid=ko.computed(function(){return b.districtId()!=null&&$.trim(b.districtId())!=""&&b.districtId()>0}),b.cityValid=ko.computed(function(){return b.cityId()!=null&&$.trim(b.cityId())!=""&&b.cityId()>0}),b.emailValid=ko.computed(function(){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,c=!0;return a.test(b.email())||(c=!1),b.email()!=null&&$.trim(b.email())!=""&&c}),b.submit=function(){if(b.firstNameValid()&&b.lastNameValid()&&b.addressValid()&&b.phoneValid()&&(b.hasEmail||!b.hasEmail&&b.emailValid())&&b.districtValid()&&b.cityValid()){var a={FirstName:b.firstName(),LastName:b.lastName(),UserId:b.userId(),Address:b.address(),Phone:b.phone(),Email:b.email(),DistrictId:b.districtId(),CityId:b.cityId(),EventId:b.eventId(),QuizPoolId:b.poolId()};$.ajax({type:"POST",url:"/Event/Register",data:a,success:function(a){a.success?(eventPopupModel.eventInfo().totalUsers(eventPopupModel.eventInfo().totalUsers()+1),eventPopupModel.reset(),eventPopupModel.successRegistered(!0)):a.errorCode==13?alert("You has already registered!"):a.errorCode==15&&alert("You do not pass the quiz!")}})}},b.provinceChanged=function(a){b.districts()!=null&&b.districts().length>0&&b.districts.removeAll();if(b.cityId()!=null&&b.cityId()>0){var c=new Date;$.get("/common/GetDistrictsByProvinceId?provinceId="+b.cityId()+"&t="+c.getTime(),function(a){b.districts(a.data)})}},b.successRegistered=ko.observable(!1)},EventInfo=function(a){var b=this;b.name=ko.observable(a.Name),b.id=ko.observable(a.Id),b.description=ko.observable(a.Description),b.totalUsers=ko.observable(a.TotalUsers),b.resId=ko.observable(a.RestaurantId),b.resName=ko.observable(a.ResName),b.resAddress=ko.observable(a.ResAddress),b.resUrl=ko.observable(a.ResUrl),b.imageUrl=ko.observable(a.ImageUrl),b.day=ko.observable(a.EventDay),b.month=ko.observable(a.EventMonth),b.time=ko.observable(a.EventTime),b.dayOfWeek=ko.observable(a.EventDayOfWeek),b.currentDate=ko.observable(a.CurrentDate),b.endDate=ko.observable(a.EndDate),b.detailUrl=a.DetailUrl,b.totalComments=a.TotalComments,b.getServerDate=function(){var a=new Date(parseInt(b.currentDate().substr(6)));return a},b.countDown=function(){$(".event-countdown").each(function(a,c){var d=new Date(parseInt($(this).attr("enddate").substr(6)));$(this).countdown({until:d,compact:!0,serverSync:b.getServerDate()})})},b.users=ko.observableArray([]),b.isLoading=ko.observable(!1),b.showInfo=ko.observable(!0),b.loadUsers=function(){if(!b.isLoading()){b.isLoading(!0);var a=new Date;$.get("/event/getusers/"+b.id()+"?t="+a.getTime(),function(a){a.success?(b.users(a.data),b.showInfo(!1),b.isLoading(!1)):b.isLoading(!1)})}},b.showEventInfo=function(){b.showInfo(!0)},b.showPlanetElement=function(a){a.nodeType===1&&$(a).hide().slideDown()},b.hidePlanetElement=function(a){a.nodeType===1&&$(a).slideUp(function(){$(a).remove()})},setTimeout(function(){b.countDown()})},EventPoupModel=function(){var a=this;a.userInfo=ko.observable(),a.eventInfo=ko.observable(),a.isLoading=ko.observable(!1),a.alreadyRegistered=ko.observable(!1),a.successRegistered=ko.observable(!1),a.load=function(b){a.Login(function(){$("#event-registry-popup").modal({persist:!0});if(!a.isLoading()){a.reset(),a.isLoading(!0);var c=new Date;$.get("/event/GetInfo?eventid="+b+"&t="+c.getTime(),function(b){b.success?(a.eventInfo(new EventInfo(b.data.Event)),a.userInfo(new EventRegisteredUser(b.data.UserInfo)),a.isLoading(!1),a.alreadyRegistered(!1),a.quiz(null),b.data.Quiz!=null&&(a.quiz(new QuizModel(b.data.Quiz)),a.quiz().start()),$("#simplemodal-container").css("height","500px"),$(window).resize()):(a.eventInfo(new EventInfo(b.data.Event)),a.isLoading(!1),a.messageError(b.msgError))})}})},a.Login=function(a){var b=new Date;$.ajax({type:"GET",url:"/Common/IsLogin?"+b.getTime(),success:function(b){b.success==1?a():LoginPopup.Show(function(){$.modal.close(),a()},function(){})}})},a.reset=function(){a.userInfo(null),a.successRegistered(!1),a.alreadyRegistered(!1),a.messageError("")},a.messageError=ko.observable(""),a.showUsers=ko.observable(!1),a.quiz=ko.observable(null),a.clearQuiz=function(){a.quiz(null)}},QuizModel=function(a){var b=this;b.quizInfo=ko.observable(a),b.currentQuestion=ko.observable(null),b.isloading=ko.observable(!1),b.quizId=ko.observable(a.Id),b.poolId=ko.observable(0),b.firstLoad=ko.observable(!0),b.totalQuestion=ko.observable(a.TotalQuestion),b.currentIndex=ko.observable(0),b.start=function(){if(!b.isloading()){b.quizResult(null),b.firstLoad(!1),b.isloading(!0);var a=new Date;$.get("/quiz/CreateQuizPool/"+b.quizId(),function(a){a.success?(b.currentQuestion(new QuestionInfo(a.data,b)),b.poolId(a.data.PoolId),b.isloading(!1),b.currentIndex(1)):b.isloading(!1)})}},b.passed=ko.observable(!1),b.confirm=function(){if(!b.isloading()){b.isloading(!0);var a="/quiz/Confirm/"+b.poolId();b.currentQuestion().question().Id>0&&(a+="?currentId="+b.currentQuestion().question().Id),b.currentQuestion().selectedAnswer()!=null&&b.currentQuestion().selectedAnswer()!=""&&(a+="&selectedId="+b.currentQuestion().selectedAnswer()),$.post(a,function(a){a.success?(b.currentQuestion(null),b.quizResult(new QuizResult(a.data)),eventPopupModel.userInfo().poolId(b.poolId),b.isloading(!1)):b.isloading(!1)})}},b.quizResult=ko.observable(null)},QuizResult=function(a){self.questionResults=ko.observableArray(a.Results),self.passed=ko.observable(a.Passed),self.totalCorrect=ko.observable(a.TotalCorrect),self.totalQuestion=ko.observable(a.TotalQuestion)},QuestionInfo=function(a,b){var c=this;c.poolId=ko.observable(a.PoolId),c.nextId=ko.observable(a.NextId),c.prevId=ko.observable(a.PrevId),c.question=ko.observable(a.Question),c.answers=ko.observableArray(a.Answers),c.selectedAnswer=ko.observable(0),c.isloading=ko.observable(!1),c.currentIndex=ko.observable(1),c.resetSelectedAnswer=function(a){c.selectedAnswer(0),c.answers(a.Answers);for(var b=0;b<a.Answers.length;b++){var d=a.Answers[b];if(d.SelectedAnswer!=null){c.selectedAnswer(d.SelectedAnswer);break}}},c.loadNext=function(){if(!c.isloading()){c.isloading(!0);var a=new Date,d="/quiz/GetNextQuestion?poolid="+c.poolId()+"&currentid="+c.question().Id;c.selectedAnswer()!=null&&c.selectedAnswer()!=""&&(d+="&selectedId="+c.selectedAnswer()),$.get(d,function(a){if(a.success){var d=a.data;c.question(d.Question),c.answers(d.Answers),c.resetSelectedAnswer(d),c.nextId(d.NextId),c.prevId(d.PrevId),c.isloading(!1),b.currentIndex(b.currentIndex()+1),c.currentIndex(b.currentIndex())}else c.isloading(!1)})}},c.loadPrev=function(){if(!c.isloading()){c.isloading(!0);var a=new Date,d="/quiz/GetPrevQuestion?poolid="+c.poolId()+"&currentid="+c.question().Id;c.selectedAnswer()!=null&&c.selectedAnswer()!=""&&(d+="&selectedId="+c.selectedAnswer()),$.get(d,function(a){if(a.success){var d=a.data;c.question(d.Question),c.answers(d.Answers),c.resetSelectedAnswer(d),c.nextId(d.NextId),c.prevId(d.PrevId),c.isloading(!1),b.currentIndex(b.currentIndex()-1),c.currentIndex(b.currentIndex())}else c.isloading(!1)})}}},eventPopupModel=new EventPoupModel;ko.bindingHandlers.slideVisible={init:function(a,b){var c=ko.utils.unwrapObservable(b());c==1?$(a).show():$(a).hide()},update:function(a,b){var c=b(),d=ko.utils.unwrapObservable(c),e=300;d==1?$(a).slideDown(e):$(a).slideUp(e)}},$(function(){$("#event-div").length&&ko.applyBindings(eventPopupModel,document.getElementById("event-div")),$(".event-registry-btn, .goEventPopup").click(function(){var a=$(this).attr("refid");ShowEvent(a)});if(window.location.hash.indexOf("#event-")==0){var a=parseInt(window.location.hash.substr(7,window.location.hash.length-7));a>0&&ShowEvent(a)}}),$(".closepopup").live("click",function(){$.modal.close()})
  84. ;function bkClass(){}function $BK(a){return typeof a=="string"&&(a=document.getElementById(a)),a&&!a.appendTo?bkExtend(a,bkElement.prototype):a}function __(a){return a}var bkExtend=function(){var a=arguments;a.length==1&&(a=[this,a[0]]);for(var b in a[1])a[0][b]=a[1][b];return a[0]};bkClass.prototype.construct=function(){},bkClass.extend=function(a){var b=function(){if(arguments[0]!==bkClass)return this.construct.apply(this,arguments)},c=new this(bkClass);return bkExtend(c,a),b.prototype=c,b.extend=this.extend,b};var bkElement=bkClass.extend({construct:function(a,b){return typeof a=="string"&&(a=(b||document).createElement(a)),a=$BK(a),a},appendTo:function(a){return a.appendChild(this),this},appendBefore:function(a){return a.parentNode.insertBefore(this,a),this},addEvent:function(a,b){return bkLib.addEvent(this,a,b),this},setContent:function(a){return this.innerHTML=a,this},pos:function(){var a=curtop=0,b=obj=this;if(obj.offsetParent)do a+=obj.offsetLeft,curtop+=obj.offsetTop;while(obj=obj.offsetParent);var c=window.opera?0:parseInt(this.getStyle("border-width")||this.style.border)||0;return[a+c,curtop+c+this.offsetHeight]},noSelect:function(){return bkLib.noSelect(this),this},parentTag:function(a){var b=this;do{if(b&&b.nodeName&&b.nodeName.toUpperCase()==a)return b;b=b.parentNode}while(b);return!1},hasClass:function(a){return this.className.match(new RegExp("(\\s|^)nicEdit-"+a+"(\\s|$)"))},addClass:function(a){return this.hasClass(a)||(this.className+=" nicEdit-"+a),this},removeClass:function(a){return this.hasClass(a)&&(this.className=this.className.replace(new RegExp("(\\s|^)nicEdit-"+a+"(\\s|$)")," ")),this},setStyle:function(a){var b=this.style;for(var c in a)switch(c){case"float":b.cssFloat=b.styleFloat=a[c];break;case"opacity":b.opacity=a[c],b.filter="alpha(opacity="+Math.round(a[c]*100)+")";break;case"className":this.className=a[c];break;default:b[c]=a[c]}return this},getStyle:function(a,b){var c=b?b:document.defaultView;if(this.nodeType==1)return c&&c.getComputedStyle?c.getComputedStyle(this,null).getPropertyValue(a):this.currentStyle[bkLib.camelize(a)]},remove:function(){return this.parentNode.removeChild(this),this},setAttributes:function(a){for(var b in a)this[b]=a[b];return this}}),bkLib={isMSIE:navigator.appVersion.indexOf("MSIE")!=-1,addEvent:function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},toArray:function(a){var b=a.length,c=new Array(b);while(b--)c[b]=a[b];return c},noSelect:function(a){a.setAttribute&&a.nodeName.toLowerCase()!="input"&&a.nodeName.toLowerCase()!="textarea"&&a.setAttribute("unselectable","on");for(var b=0;b<a.childNodes.length;b++)bkLib.noSelect(a.childNodes[b])},camelize:function(a){return a.replace(/\-(.)/g,function(a,b){return b.toUpperCase()})},inArray:function(a,b){return bkLib.search(a,b)!=null},search:function(a,b){for(var c=0;c<a.length;c++)if(a[c]==b)return c;return null},cancelEvent:function(a){return a=a||window.event,a.preventDefault&&a.stopPropagation&&(a.preventDefault(),a.stopPropagation()),!1},domLoad:[],domLoaded:function(){if(arguments.callee.done)return;arguments.callee.done=!0;for(i=0;i<bkLib.domLoad.length;i++)bkLib.domLoad[i]()},onDomLoaded:function(a){this.domLoad.push(a),document.addEventListener?document.addEventListener("DOMContentLoaded",bkLib.domLoaded,null):bkLib.isMSIE&&(document.write("<style>.nicEdit-main p { margin: 0; }</style><script id=__ie_onload defer "+(location.protocol=="https:"?"src='javascript:void(0)'":"src=//0")+"></scr"+"ipt>"),$BK("__ie_onload").onreadystatechange=function(){this.readyState=="complete"&&bkLib.domLoaded()}),window.onload=bkLib.domLoaded}},bkEvent={addEvent:function(a,b){return b&&(this.eventList=this.eventList||{},this.eventList[a]=this.eventList[a]||[],this.eventList[a].push(b)),this},fireEvent:function(){var a=bkLib.toArray(arguments),b=a.shift();if(this.eventList&&this.eventList[b])for(var c=0;c<this.eventList[b].length;c++)this.eventList[b][c].apply(this,a)}};Function.prototype.closure=function(){var a=this,b=bkLib.toArray(arguments),c=b.shift();return function(){if(typeof bkLib!="undefined")return a.apply(c,b.concat(bkLib.toArray(arguments)))}},Function.prototype.closureListener=function(){var a=this,b=bkLib.toArray(arguments),c=b.shift();return function(d){d=d||window.event;if(d.target)var e=d.target;else var e=d.srcElement;return a.apply(c,[d,e].concat(b))}};var nicEditorConfig=bkClass.extend({buttons:{bold:{name:__("In đậm"),command:"Bold",tags:["B","STRONG"],css:{"font-weight":"bold"},key:"b"},italic:{name:__("In nghiêng"),command:"Italic",tags:["EM","I"],css:{"font-style":"italic"},key:"i"},underline:{name:__("Gạch dưới"),command:"Underline",tags:["U"],css:{"text-decoration":"underline"},key:"u"},left:{name:__("Left Align"),command:"justifyleft",noActive:!0},center:{name:__("Center Align"),command:"justifycenter",noActive:!0},right:{name:__("Right Align"),command:"justifyright",noActive:!0},justify:{name:__("Justify Align"),command:"justifyfull",noActive:!0},ol:{name:__("Insert Ordered List"),command:"insertorderedlist",tags:["OL"]},ul:{name:__("Insert Unordered List"),command:"insertunorderedlist",tags:["UL"]},subscript:{name:__("Click to Subscript"),command:"subscript",tags:["SUB"]},superscript:{name:__("Click to Superscript"),command:"superscript",tags:["SUP"]},strikethrough:{name:__("Click to Strike Through"),command:"strikeThrough",css:{"text-decoration":"line-through"}},removeformat:{name:__("Remove Formatting"),command:"removeformat",noActive:!0},indent:{name:__("Indent Text"),command:"indent",noActive:!0},outdent:{name:__("Remove Indent"),command:"outdent",noActive:!0},hr:{name:__("Horizontal Rule"),command:"insertHorizontalRule",noActive:!0}},iconsPath:"../nicEditorIcons.gif",buttonList:["save","bold","italic","underline","left","center","right","justify","ol","ul","fontSize","fontFamily","fontFormat","indent","outdent","image","upload","link","unlink","forecolor","bgcolor"],iconList:{xhtml:1,bgcolor:2,forecolor:3,bold:4,center:5,hr:6,indent:7,italic:8,justify:9,left:10,ol:11,outdent:12,removeformat:13,right:14,save:25,strikethrough:16,subscript:17,superscript:18,ul:19,underline:20,image:21,link:22,unlink:23,close:24,arrow:26,upload:27},initWithLineBreak:!0}),nicEditors={nicPlugins:[],editors:[],registerPlugin:function(a,b){this.nicPlugins.push({p:a,o:b})},allTextAreas:function(a){var b=document.getElementsByTagName("textarea");for(var c=0;c<b.length;c++)nicEditors.editors.push((new nicEditor(a)).panelInstance(b[c]));return nicEditors.editors},findEditor:function(a){var b=nicEditors.editors;for(var c=0;c<b.length;c++)if(b[c].instanceById(a))return b[c]}},nicEditor=bkClass.extend({construct:function(a){this.options=new nicEditorConfig,bkExtend(this.options,a),this.nicInstances=new Array,this.loadedPlugins=new Array;var b=nicEditors.nicPlugins;for(var c=0;c<b.length;c++)this.loadedPlugins.push(new b[c].p(this,b[c].o));nicEditors.editors.push(this),bkLib.addEvent(document.body,"mousedown",this.selectCheck.closureListener(this))},panelInstance:function(a,b){a=this.checkReplace($BK(a));var c=(new bkElement("DIV")).setStyle({width:(parseInt(a.getStyle("width"))||a.clientWidth)+"px"}).appendBefore(a);return this.setPanel(c),this.addInstance(a,b)},checkReplace:function(a){var b=nicEditors.findEditor(a);return b&&(b.removeInstance(a),b.removePanel()),a},addInstance:function(a,b){a=this.checkReplace($BK(a));if(a.contentEditable||!!window.opera)var c=new nicEditorInstance(a,b,this);else var c=new nicEditorIFrameInstance(a,b,this);return this.nicInstances.push(c),this},removeInstance:function(a){a=$BK(a);var b=this.nicInstances;for(var c=0;c<b.length;c++)b[c].e==a&&(b[c].remove(),this.nicInstances.splice(c,1))},removePanel:function(a){this.nicPanel&&(this.nicPanel.remove(),this.nicPanel=null)},instanceById:function(a){a=$BK(a);var b=this.nicInstances;for(var c=0;c<b.length;c++)if(b[c].e==a)return b[c]},setPanel:function(a){return this.nicPanel=new nicEditorPanel($BK(a),this.options,this),this.fireEvent("panel",this.nicPanel),this},nicCommand:function(a,b){this.selectedInstance&&this.selectedInstance.nicCommand(a,b)},getIcon:function(a,b){var c=this.options.iconList[a],d=b.iconFiles?b.iconFiles[a]:"";return{backgroundImage:"url('"+(c?this.options.iconsPath:d)+"')",backgroundPosition:(c?(c-1)*-18:0)+"px 0px"}},selectCheck:function(a,b){var c=!1;do if(b.className&&b.className.indexOf("nicEdit")!=-1)return!1;while(b=b.parentNode);return this.fireEvent("blur",this.selectedInstance,b),this.lastSelectedInstance=this.selectedInstance,this.selectedInstance=null,!1}});nicEditor=nicEditor.extend(bkEvent);var nicEditorInstance=bkClass.extend({isSelected:!1,construct:function(a,b,c){this.ne=c,this.elm=this.e=a,this.options=b||{},newX=parseInt(a.getStyle("width"))||a.clientWidth,newY=parseInt(a.getStyle("height"))||a.clientHeight,this.initialHeight=newY-8;var d=a.nodeName.toLowerCase()=="textarea";if(d||this.options.hasPanel){var e=bkLib.isMSIE&&(typeof document.body.style.maxHeight=="undefined"||document.compatMode!="CSS1Compat"),f={width:newX+"px",border:"1px solid #ccc",borderTop:0,overflowY:"auto",overflowX:"hidden"};f[e?"height":"maxHeight"]=this.ne.options.maxHeight?this.ne.options.maxHeight+"px":null,this.editorContain=(new bkElement("DIV")).setStyle(f).appendBefore(a);var g=(new bkElement("DIV")).setStyle({width:newX-8+"px",margin:"4px",minHeight:newY+"px"}).addClass("main").appendTo(this.editorContain);a.setStyle({display:"none"}),g.innerHTML=a.innerHTML;if(d){g.setContent(a.value),this.copyElm=a;var h=a.parentTag("FORM");h&&bkLib.addEvent(h,"submit",this.saveContent.closure(this))}g.setStyle(e?{height:newY+"px"}:{overflow:"hidden"}),this.elm=g}this.ne.addEvent("blur",this.blur.closure(this)),this.init(),this.blur()},init:function(){this.elm.setAttribute("contentEditable","true"),this.getContent()==""&&this.options.initWithLineBreak&&this.setContent("<br />"),this.instanceDoc=document.defaultView,this.elm.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keypress",this.keyDown.closureListener(this)).addEvent("focus",this.selected.closure(this)).addEvent("blur",this.blur.closure(this)).addEvent("keyup",this.selected.closure(this)),this.ne.fireEvent("add",this)},remove:function(){this.saveContent();if(this.copyElm||this.options.hasPanel)this.editorContain.remove(),this.e.setStyle({display:"block"}),this.ne.removePanel();this.disable(),this.ne.fireEvent("remove",this)},disable:function(){this.elm.setAttribute("contentEditable","false")},getSel:function(){return window.getSelection?window.getSelection():document.selection},getRng:function(){var a=this.getSel();return a?a.rangeCount>0?a.getRangeAt(0):a.createRange&&a.createRange()||document.createRange():null},selRng:function(a,b){window.getSelection?(b.removeAllRanges(),b.addRange(a)):a.select()},selElm:function(){var a=this.getRng();if(a.startContainer){var b=a.startContainer;if(a.cloneContents().childNodes.length==1)for(var c=0;c<b.childNodes.length;c++){var d=b.childNodes[c].ownerDocument.createRange();d.selectNode(b.childNodes[c]);if(a.compareBoundaryPoints(Range.START_TO_START,d)!=1&&a.compareBoundaryPoints(Range.END_TO_END,d)!=-1)return $BK(b.childNodes[c])}return $BK(b)}return $BK(this.getSel().type=="Control"?a.item(0):a.parentElement())},saveRng:function(){this.savedRange=this.getRng(),this.savedSel=this.getSel()},restoreRng:function(){this.savedRange&&this.selRng(this.savedRange,this.savedSel)},keyDown:function(a,b){this.ne.fireEvent("keyDown",this,a),a.ctrlKey&&this.ne.fireEvent("key",this,a)},selected:function(a,b){b||(b=this.selElm());if(!a.ctrlKey){var c=this.ne.selectedInstance;c!=this&&(c&&this.ne.fireEvent("blur",c,b),this.ne.selectedInstance=this,this.ne.fireEvent("focus",c,b)),this.ne.fireEvent("selected",c,b),this.isFocused=!0,this.elm.addClass("selected")}return!1},blur:function(){this.isFocused=!1,this.elm.removeClass("selected")},saveContent:function(){if(this.copyElm||this.options.hasPanel)this.ne.fireEvent("save",this),this.copyElm?this.copyElm.value=this.getContent():this.e.innerHTML=this.getContent()},getElm:function(){return this.elm},getContent:function(){return this.content=this.getElm().innerHTML,this.ne.fireEvent("get",this),this.content},setContent:function(a){this.content=a,this.ne.fireEvent("set",this),this.elm.innerHTML=this.content},nicCommand:function(a,b){document.execCommand(a,!1,b)}}),nicEditorIFrameInstance=nicEditorInstance.extend({savedStyles:[],init:function(){var a=this.elm.innerHTML.replace(/^\s+|\s+$/g,"");this.elm.innerHTML="",a?a:a="<br />",this.initialContent=a,this.elmFrame=(new bkElement("iframe")).setAttributes({src:"javascript:;",frameBorder:0,allowTransparency:"true",scrolling:"no"}).setStyle({height:"100px",width:"100%"}).addClass("frame").appendTo(this.elm),this.copyElm&&this.elmFrame.setStyle({width:this.elm.offsetWidth-4+"px"});var b=["font-size","font-family","font-weight","color"];for(itm in b)this.savedStyles[bkLib.camelize(itm)]=this.elm.getStyle(itm);setTimeout(this.initFrame.closure(this),50)},disable:function(){this.elm.innerHTML=this.getContent()},initFrame:function(){var a=$BK(this.elmFrame.contentWindow.document);a.designMode="on",a.open();var b=this.ne.options.externalCSS;a.write("<html><head>"+(b?'<link href="'+b+'" rel="stylesheet" type="text/css" />':"")+'</head><body id="nicEditContent" style="margin: 0 !important; background-color: transparent !important;">'+this.initialContent+"</body></html>"),a.close(),this.frameDoc=a,this.frameWin=$BK(this.elmFrame.contentWindow),this.frameContent=$BK(this.frameWin.document.body).setStyle(this.savedStyles),this.instanceDoc=this.frameWin.document.defaultView,this.heightUpdate(),this.frameDoc.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keyup",this.heightUpdate.closureListener(this)).addEvent("keydown",this.keyDown.closureListener(this)).addEvent("keyup",this.selected.closure(this)),this.ne.fireEvent("add",this)},getElm:function(){return this.frameContent},setContent:function(a){this.content=a,this.ne.fireEvent("set",this),this.frameContent.innerHTML=this.content,this.heightUpdate()},getSel:function(){return this.frameWin?this.frameWin.getSelection():this.frameDoc.selection},heightUpdate:function(){this.elmFrame.style.height=Math.max(this.frameContent.offsetHeight,this.initialHeight)+"px"},nicCommand:function(a,b){this.frameDoc.execCommand(a,!1,b),setTimeout(this.heightUpdate.closure(this),100)}}),nicEditorPanel=bkClass.extend({construct:function(a,b,c){this.elm=a,this.options=b,this.ne=c,this.panelButtons=new Array,this.buttonList=bkExtend([],this.ne.options.buttonList),this.panelContain=(new bkElement("DIV")).setStyle({overflow:"hidden",width:"100%",border:"1px solid #cccccc",backgroundColor:"#efefef"}).addClass("panelContain"),this.panelElm=(new bkElement("DIV")).setStyle({margin:"2px",marginTop:"0px",zoom:1,overflow:"hidden"}).addClass("panel").appendTo(this.panelContain),this.panelContain.appendTo(a);var d=this.ne.options,e=d.buttons;for(button in e)this.addButton(button,d,!0);this.reorder(),a.noSelect()},addButton:function(buttonName,options,noOrder){var button=options.buttons[buttonName],type=button.type?eval("(typeof("+button.type+') == "undefined") ? null : '+button.type+";"):nicEditorButton,hasButton=bkLib.inArray(this.buttonList,buttonName);type&&(hasButton||this.ne.options.fullPanel)&&(this.panelButtons.push(new type(this.panelElm,buttonName,options,this.ne)),hasButton||this.buttonList.push(buttonName))},findButton:function(a){for(var b=0;b<this.panelButtons.length;b++)if(this.panelButtons[b].name==a)return this.panelButtons[b]},reorder:function(){var a=this.buttonList;for(var b=0;b<a.length;b++){var c=this.findButton(a[b]);c&&this.panelElm.appendChild(c.margin)}},remove:function(){this.elm.remove()}}),nicEditorButton=bkClass.extend({construct:function(a,b,c,d){this.options=c.buttons[b],this.name=b,this.ne=d,this.elm=a,this.margin=(new bkElement("DIV")).setStyle({"float":"left",marginTop:"2px"}).appendTo(a),this.contain=(new bkElement("DIV")).setStyle({width:"20px",height:"20px"}).addClass("buttonContain").appendTo(this.margin),this.border=(new bkElement("DIV")).setStyle({backgroundColor:"#efefef",border:"1px solid #efefef"}).appendTo(this.contain),this.button=(new bkElement("DIV")).setStyle({width:"18px",height:"18px",overflow:"hidden",zoom:1,cursor:"pointer"}).addClass("button").setStyle(this.ne.getIcon(b,c)).appendTo(this.border),this.button.addEvent("mouseover",this.hoverOn.closure(this)).addEvent("mouseout",this.hoverOff.closure(this)).addEvent("mousedown",this.mouseClick.closure(this)).noSelect(),window.opera||(this.button.onmousedown=this.button.onclick=bkLib.cancelEvent),d.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this)).addEvent("key",this.key.closure(this)),this.disable(),this.init()},init:function(){},hide:function(){this.contain.setStyle({display:"none"})},updateState:function(){this.isDisabled?this.setBg():this.isHover?this.setBg("hover"):this.isActive?this.setBg("active"):this.setBg()},setBg:function(a){switch(a){case"hover":var b={border:"1px solid #666",backgroundColor:"#ddd"};break;case"active":var b={border:"1px solid #666",backgroundColor:"#ccc"};break;default:var b={border:"1px solid #efefef",backgroundColor:"#efefef"}}this.border.setStyle(b).addClass("button-"+a)},checkNodes:function(a){var b=a;do if(this.options.tags&&bkLib.inArray(this.options.tags,b.nodeName))return this.activate(),!0;while((b=b.parentNode)&&b.className!="nicEdit");b=$BK(a);while(b.nodeType==3)b=$BK(b.parentNode);if(this.options.css)for(itm in this.options.css)if(b.getStyle(itm,this.ne.selectedInstance.instanceDoc)==this.options.css[itm])return this.activate(),!0;return this.deactivate(),!1},activate:function(){this.isDisabled||(this.isActive=!0,this.updateState(),this.ne.fireEvent("buttonActivate",this))},deactivate:function(){this.isActive=!1,this.updateState(),this.isDisabled||this.ne.fireEvent("buttonDeactivate",this)},enable:function(a,b){this.isDisabled=!1,this.contain.setStyle({opacity:1}).addClass("buttonEnabled"),this.updateState(),b!==document&&this.checkNodes(b)},disable:function(a,b){this.isDisabled=!0,this.contain.setStyle({opacity:.6}).removeClass("buttonEnabled"),this.updateState()},toggleActive:function(){this.isActive?this.deactivate():this.activate()},hoverOn:function(){this.isDisabled||(this.isHover=!0,this.updateState(),this.ne.fireEvent("buttonOver",this))},hoverOff:function(){this.isHover=!1,this.updateState(),this.ne.fireEvent("buttonOut",this)},mouseClick:function(){this.options.command&&(this.ne.nicCommand(this.options.command,this.options.commandArgs),this.options.noActive||this.toggleActive()),this.ne.fireEvent("buttonClick",this)},key:function(a,b){this.options.key&&b.ctrlKey&&String.fromCharCode(b.keyCode||b.charCode).toLowerCase()==this.options.key&&(this.mouseClick(),b.preventDefault&&b.preventDefault())}}),nicPlugin=bkClass.extend({construct:function(a,b){this.options=b,this.ne=a,this.ne.addEvent("panel",this.loadPanel.closure(this)),this.init()},loadPanel:function(a){var b=this.options.buttons;for(var c in b)a.addButton(c,this.options);a.reorder()},init:function(){}}),nicPaneOptions={},nicEditorPane=bkClass.extend({construct:function(a,b,c,d){this.ne=b,this.elm=a,this.pos=a.pos(),this.contain=(new bkElement("div")).setStyle({zIndex:"99999",overflow:"hidden",position:"absolute",left:this.pos[0]+"px",top:this.pos[1]+"px"}),this.pane=(new bkElement("div")).setStyle({fontSize:"12px",border:"1px solid #ccc",overflow:"hidden",padding:"4px",textAlign:"left",backgroundColor:"#ffffc9"}).addClass("pane").setStyle(c).appendTo(this.contain),d&&!d.options.noClose&&(this.close=(new bkElement("div")).setStyle({"float":"right",height:"16px",width:"16px",cursor:"pointer"}).setStyle(this.ne.getIcon("close",nicPaneOptions)).addEvent("mousedown",d.removePane.closure(this)).appendTo(this.pane)),this.contain.noSelect().appendTo(document.body),this.position(),this.init()},init:function(){},position:function(){if(this.ne.nicPanel){var a=this.ne.nicPanel.elm,b=a.pos(),c=b[0]+parseInt(a.getStyle("width"))-(parseInt(this.pane.getStyle("width"))+8);c<this.pos[0]&&this.contain.setStyle({left:c+"px"})}},toggle:function(){this.isVisible=!this.isVisible,this.contain.setStyle({display:this.isVisible?"block":"none"})},remove:function(){this.contain&&(this.contain.remove(),this.contain=null)},append:function(a){a.appendTo(this.pane)},setContent:function(a){this.pane.setContent(a)}}),nicEditorAdvancedButton=nicEditorButton.extend({init:function(){this.ne.addEvent("selected",this.removePane.closure(this)).addEvent("blur",this.removePane.closure(this))},mouseClick:function(){this.isDisabled||(this.pane&&this.pane.pane?this.removePane():(this.pane=new nicEditorPane(this.contain,this.ne,{width:this.width||"270px",backgroundColor:"#fff"},this),this.addPane(),this.ne.selectedInstance.saveRng()))},addForm:function(a,b){this.form=(new bkElement("form")).addEvent("submit",this.submit.closureListener(this)),this.pane.append(this.form),this.inputs={};for(itm in a){var c=a[itm],d="";b&&(d=b.getAttribute(itm)),d||(d=c.value||"");var e=a[itm].type;if(e=="title")(new bkElement("div")).setContent(c.txt).setStyle({fontSize:"14px",fontWeight:"bold",padding:"0px",margin:"2px 0"}).appendTo(this.form);else{var f=(new bkElement("div")).setStyle({overflow:"hidden",clear:"both"}).appendTo(this.form);c.txt&&(new bkElement("label")).setAttributes({"for":itm}).setContent(c.txt).setStyle({margin:"2px 4px",fontSize:"13px",width:"50px",lineHeight:"20px",textAlign:"right","float":"left"}).appendTo(f);switch(e){case"text":this.inputs[itm]=(new bkElement("input")).setAttributes({id:itm,value:d,type:"text"}).setStyle({margin:"2px 0",fontSize:"13px","float":"left",height:"20px",border:"1px solid #ccc",overflow:"hidden"}).setStyle(c.style).appendTo(f);break;case"select":this.inputs[itm]=(new bkElement("select")).setAttributes({id:itm}).setStyle({border:"1px solid #ccc","float":"left",margin:"2px 0"}).appendTo(f);for(opt in c.options)var g=(new bkElement("option")).setAttributes({value:opt,selected:opt==d?"selected":""}).setContent(c.options[opt]).appendTo(this.inputs[itm]);break;case"content":this.inputs[itm]=(new bkElement("textarea")).setAttributes({id:itm}).setStyle({border:"1px solid #ccc","float":"left"}).setStyle(c.style).appendTo(f),this.inputs[itm].value=d}}}(new bkElement("input")).setAttributes({type:"submit"}).setStyle({backgroundColor:"#efefef",border:"1px solid #ccc",margin:"3px 0","float":"left",clear:"both"}).appendTo(this.form),this.form.onsubmit=bkLib.cancelEvent},submit:function(){},findElm:function(a,b,c){var d=this.ne.selectedInstance.getElm().getElementsByTagName(a);for(var e=0;e<d.length;e++)if(d[e].getAttribute(b)==c)return $BK(d[e])},removePane:function(){this.pane&&(this.pane.remove(),this.pane=null,this.ne.selectedInstance.restoreRng())}}),nicButtonTips=bkClass.extend({construct:function(a){this.ne=a,a.addEvent("buttonOver",this.show.closure(this)).addEvent("buttonOut",this.hide.closure(this))},show:function(a){this.timer=setTimeout(this.create.closure(this,a),400)},create:function(a){this.timer=null,this.pane||(this.pane=new nicEditorPane(a.button,this.ne,{fontSize:"12px",marginTop:"5px"}),this.pane.setContent(a.options.name))},hide:function(a){this.timer&&clearTimeout(this.timer),this.pane&&(this.pane=this.pane.remove())}});nicEditors.registerPlugin(nicButtonTips);var nicSelectOptions={buttons:{fontSize:{name:__("Select Font Size"),type:"nicEditorFontSizeSelect",command:"fontsize"},fontFamily:{name:__("Select Font Family"),type:"nicEditorFontFamilySelect",command:"fontname"},fontFormat:{name:__("Select Font Format"),type:"nicEditorFontFormatSelect",command:"formatBlock"}}},nicEditorSelect=bkClass.extend({construct:function(a,b,c,d){this.options=c.buttons[b],this.elm=a,this.ne=d,this.name=b,this.selOptions=new Array,this.margin=(new bkElement("div")).setStyle({"float":"left",margin:"2px 1px 0 1px"}).appendTo(this.elm),this.contain=(new bkElement("div")).setStyle({width:"90px",height:"20px",cursor:"pointer",overflow:"hidden"}).addClass("selectContain").addEvent("click",this.toggle.closure(this)).appendTo(this.margin),this.items=(new bkElement("div")).setStyle({overflow:"hidden",zoom:1,border:"1px solid #ccc",paddingLeft:"3px",backgroundColor:"#fff"}).appendTo(this.contain),this.control=(new bkElement("div")).setStyle({overflow:"hidden","float":"right",height:"18px",width:"16px"}).addClass("selectControl").setStyle(this.ne.getIcon("arrow",c)).appendTo(this.items),this.txt=(new bkElement("div")).setStyle({overflow:"hidden","float":"left",width:"66px",height:"14px",marginTop:"1px",fontFamily:"sans-serif",textAlign:"center",fontSize:"12px"}).addClass("selectTxt").appendTo(this.items),window.opera||(this.contain.onmousedown=this.control.onmousedown=this.txt.onmousedown=bkLib.cancelEvent),this.margin.noSelect(),this.ne.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this)),this.disable(),this.init()},disable:function(){this.isDisabled=!0,this.close(),this.contain.setStyle({opacity:.6})},enable:function(a){this.isDisabled=!1,this.close(),this.contain.setStyle({opacity:1})},setDisplay:function(a){this.txt.setContent(a)},toggle:function(){this.isDisabled||(this.pane?this.close():this.open())},open:function(){this.pane=new nicEditorPane(this.items,this.ne,{width:"88px",padding:"0px",borderTop:0,borderLeft:"1px solid #ccc",borderRight:"1px solid #ccc",borderBottom:"0px",backgroundColor:"#fff"});for(var a=0;a<this.selOptions.length;a++){var b=this.selOptions[a],c=(new bkElement("div")).setStyle({overflow:"hidden",borderBottom:"1px solid #ccc",width:"88px",textAlign:"left",overflow:"hidden",cursor:"pointer"}),d=(new bkElement("div")).setStyle({padding:"0px 4px"}).setContent(b[1]).appendTo(c).noSelect();d.addEvent("click",this.update.closure(this,b[0])).addEvent("mouseover",this.over.closure(this,d)).addEvent("mouseout",this.out.closure(this,d)).setAttributes("id",b[0]),this.pane.append(c),window.opera||(d.onmousedown=bkLib.cancelEvent)}},close:function(){this.pane&&(this.pane=this.pane.remove())},over:function(a){a.setStyle({backgroundColor:"#ccc"})},out:function(a){a.setStyle({backgroundColor:"#fff"})},add:function(a,b){this.selOptions.push(new Array(a,b))},update:function(a){this.ne.nicCommand(this.options.command,a),this.close()}}),nicEditorFontSizeSelect=nicEditorSelect.extend({sel:{1:"1&nbsp;(8pt)",2:"2&nbsp;(10pt)",3:"3&nbsp;(12pt)",4:"4&nbsp;(14pt)",5:"5&nbsp;(18pt)",6:"6&nbsp;(24pt)"},init:function(){this.setDisplay("Font&nbsp;Size...");for(itm in this.sel)this.add(itm,'<font size="'+itm+'">'+this.sel[itm]+"</font>")}}),nicEditorFontFamilySelect=nicEditorSelect.extend({sel:{arial:"Arial","comic sans ms":"Comic Sans","courier new":"Courier New",georgia:"Georgia",helvetica:"Helvetica",impact:"Impact","times new roman":"Times","trebuchet ms":"Trebuchet",verdana:"Verdana"},init:function(){this.setDisplay("Font&nbsp;Family...");for(itm in this.sel)this.add(itm,'<font face="'+itm+'">'+this.sel[itm]+"</font>")}}),nicEditorFontFormatSelect=nicEditorSelect.extend({sel:{p:"Paragraph",pre:"Pre",h6:"Heading&nbsp;6",h5:"Heading&nbsp;5",h4:"Heading&nbsp;4",h3:"Heading&nbsp;3",h2:"Heading&nbsp;2",h1:"Heading&nbsp;1"},init:function(){this.setDisplay("Font&nbsp;Format...");for(itm in this.sel){var a=itm.toUpperCase();this.add("<"+a+">","<"+itm+' style="padding: 0px; margin: 0px;">'+this.sel[itm]+"</"+a+">")}}});nicEditors.registerPlugin(nicPlugin,nicSelectOptions);var nicLinkOptions={buttons:{link:{name:"Thêm liên kết",type:"nicLinkButton",tags:["A"]},unlink:{name:"Xóa liên kết",command:"unlink",noActive:!0}}},nicLinkButton=nicEditorAdvancedButton.extend({addPane:function(){this.ln=this.ne.selectedInstance.selElm().parentTag("A"),this.addForm({"":{type:"title",txt:"Thêm / Chỉnh sửa liên kết"},href:{type:"text",txt:"Liên kết",value:"http://",style:{width:"150px"}},title:{type:"text",txt:"Tiêu đề"},target:{type:"select",txt:"Mở trong",options:{"":"Cửa sổ hiện tại",_blank:"Cửa sổ mới"},style:{width:"100px"}}},this.ln)},submit:function(a){var b=this.inputs.href.value;if(b=="http://"||b=="")return alert("Bạn chưa nhập liên kết."),!1;this.removePane();if(!this.ln){var c="javascript:nicTemp();";this.ne.nicCommand("createlink",c),this.ln=this.findElm("A","href",c),this.ln.innerHTML==c&&(this.ln.innerHTML=this.inputs.title.value||b)}if(this.ln){var d=this.ln.title;this.ln.setAttributes({href:this.inputs.href.value,title:this.inputs.title.value,target:this.inputs.target.options[this.inputs.target.selectedIndex].value}),this.ln.innerHTML==d&&(this.ln.innerHTML=this.inputs.title.value||this.inputs.href.value)}}});nicEditors.registerPlugin(nicPlugin,nicLinkOptions);var nicColorOptions={buttons:{forecolor:{name:__("Change Text Color"),type:"nicEditorColorButton",noClose:!0},bgcolor:{name:__("Change Background Color"),type:"nicEditorBgColorButton",noClose:!0}}},nicEditorColorButton=nicEditorAdvancedButton.extend({addPane:function(){var a={0:"00",1:"33",2:"66",3:"99",4:"CC",5:"FF"},b=(new bkElement("DIV")).setStyle({width:"270px"});for(var c in a)for(var d in a)for(var e in a){var f="#"+a[c]+a[e]+a[d],g=(new bkElement("DIV")).setStyle({cursor:"pointer",height:"15px","float":"left"}).appendTo(b),h=(new bkElement("DIV")).setStyle({border:"2px solid "+f}).appendTo(g),i=(new bkElement("DIV")).setStyle({backgroundColor:f,overflow:"hidden",width:"11px",height:"11px"}).addEvent("click",this.colorSelect.closure(this,f)).addEvent("mouseover",this.on.closure(this,h)).addEvent("mouseout",this.off.closure(this,h,f)).appendTo(h);window.opera||(g.onmousedown=i.onmousedown=bkLib.cancelEvent)}this.pane.append(b.noSelect())},colorSelect:function(a){this.ne.nicCommand("foreColor",a),this.removePane()},on:function(a){a.setStyle({border:"2px solid #000"})},off:function(a,b){a.setStyle({border:"2px solid "+b})}}),nicEditorBgColorButton=nicEditorColorButton.extend({colorSelect:function(a){this.ne.nicCommand("hiliteColor",a),this.removePane()}});nicEditors.registerPlugin(nicPlugin,nicColorOptions);var nicImageOptions={buttons:{image:{name:"Thêm hình",type:"nicImageButton",tags:["IMG"]}}},nicImageButton=nicEditorAdvancedButton.extend({addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG"),this.addForm({"":{type:"title",txt:"Thêm / Chỉnh sửa hình ảnh"},src:{type:"text",txt:"Link hình",value:"http://",style:{width:"150px"}},alt:{type:"text",txt:"Mô tả",style:{width:"100px"}},align:{type:"select",txt:"Canh lề",options:{none:"Mặc định",left:"Trái",right:"Phải"}}},this.im)},submit:function(a){var b=this.inputs.src.value;if(b==""||b=="http://")return alert("Bạn chưa nhập link hình."),!1;this.removePane();if(!this.im){var c="javascript:nicImTemp();";this.ne.nicCommand("insertImage",c),this.im=this.findElm("IMG","src",c)}this.im&&this.im.setAttributes({src:this.inputs.src.value,alt:this.inputs.alt.value,align:this.inputs.align.value})}});nicEditors.registerPlugin(nicPlugin,nicImageOptions);var nicSaveOptions={buttons:{save:{name:__("Save this content"),type:"nicEditorSaveButton"}}},nicEditorSaveButton=nicEditorButton.extend({init:function(){this.ne.options.onSave||this.margin.setStyle({display:"none"})},mouseClick:function(){var a=this.ne.options.onSave,b=this.ne.selectedInstance;a(b.getContent(),b.elm.id,b)}});nicEditors.registerPlugin(nicPlugin,nicSaveOptions);var nicUploadOptions={buttons:{upload:{name:"Upload Image",type:"nicUploadButton"}}},nicUploadButton=nicEditorAdvancedButton.extend({nicURI:"http://files.nicedit.com/",addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG"),this.myID=Math.round(Math.random()*Math.pow(10,15)),this.requestInterval=1e3,this.uri=this.ne.options.uploadURI||this.nicURI,nicUploadButton.lastPlugin=this,this.myFrame=(new bkElement("iframe")).setAttributes({width:"100%",height:"100px",frameBorder:0,scrolling:"no"}).setStyle({border:0}).appendTo(this.pane.pane),this.progressWrapper=(new bkElement("div")).setStyle({display:"none",width:"100%",height:"20px",border:"1px solid #ccc"}).appendTo(this.pane.pane),this.progress=(new bkElement("div")).setStyle({width:"0%",height:"20px",backgroundColor:"#ccc"}).setContent("&nbsp").appendTo(this.progressWrapper),setTimeout(this.addForm.closure(this),50)},addForm:function(){var a=this.myDoc=this.myFrame.contentWindow.document;a.open(),a.write("<html><body>"),a.write('<form method="post" action="'+this.uri+"?id="+this.myID+'" enctype="multipart/form-data">'),a.write('<input type="hidden" name="APC_UPLOAD_PROGRESS" value="'+this.myID+'" />'),this.uri==this.nicURI&&a.write('<div style="position: absolute; margin-left: 160px;"><img src="http://imageshack.us/img/imageshack.png" width="30" style="float: left;" /><div style="float: left; margin-left: 5px; font-size: 10px;">Hosted by<br /><a href="http://www.imageshack.us/" target="_blank">ImageShack</a></div></div>'),a.write('<div style="font-size: 14px; font-weight: bold; padding-top: 5px;">Insert an Image</div>'),a.write('<input name="nicImage" type="file" style="margin-top: 10px;" />'),a.write("</form>"),a.write("</body></html>"),a.close(),this.myBody=a.body,this.myForm=$BK(this.myBody.getElementsByTagName("form")[0]),this.myInput=$BK(this.myBody.getElementsByTagName("input")[1]).addEvent("change",this.startUpload.closure(this)),this.myStatus=(new bkElement("div",this.myDoc)).setStyle({textAlign:"center",fontSize:"14px"}).appendTo(this.myBody)},startUpload:function(){this.myForm.setStyle({display:"none"}),this.myStatus.setContent('<img src="http://files.nicedit.com/ajax-loader.gif" style="float: right; margin-right: 40px;" /><strong>Uploading...</strong><br />Please wait'),this.myForm.submit(),setTimeout(this.makeRequest.closure(this),this.requestInterval)},makeRequest:function(){if(this.pane&&this.pane.pane){nicUploadButton.lastPlugin=this;var a=(new bkElement("script")).setAttributes({type:"text/javascript",src:this.uri+"?check="+this.myID+"&rand="+Math.round(Math.random()*Math.pow(10,15))}).addEvent("load",function(){a.parentNode.removeChild(a)}).appendTo(document.getElementsByTagName("head")[0]);this.requestInterval&&setTimeout(this.makeRequest.closure(this),this.requestInterval)}},setProgress:function(a){this.progressWrapper.setStyle({display:"block"}),this.progress.setStyle({width:a+"%"})},update:function(a){if(a==0)this.progressWrapper.setStyle({display:"none"});else if(a.url){this.setProgress(100),this.requestInterval=!1;if(!this.im){this.ne.selectedInstance.restoreRng();var b="javascript:nicImTemp();";this.ne.nicCommand("insertImage",b),this.im=this.findElm("IMG","src",b)}var c=parseInt(this.ne.selectedInstance.elm.getStyle("width"));this.im&&this.im.setAttributes({src:a.url,width:c&&a.width?Math.min(c,a.width):""}),this.removePane()}else if(a.error)this.requestInterval=!1,this.setProgress(100),alert("There was an error uploading your image ("+a.error+")."),this.removePane();else if(a.noprogress){this.progressWrapper.setStyle({display:"none"});if(this.uri.indexOf("http:")==-1||this.uri.indexOf(window.location.host)!=-1)this.requestInterval=!1}else this.setProgress(Math.round(a.current/a.total*75)),a.interval&&(this.requestInterval=a.interval)}});nicUploadButton.statusCb=function(a){nicUploadButton.lastPlugin.update(a)},nicEditors.registerPlugin(nicPlugin,nicUploadOptions);var nicXHTML=bkClass.extend({stripAttributes:["_moz_dirty","_moz_resizing","_extended"],noShort:["style","title","script","textarea","a"],cssReplace:{"font-weight:bold;":"strong","font-style:italic;":"em"},sizes:{1:"xx-small",2:"x-small",3:"small",4:"medium",5:"large",6:"x-large"},construct:function(a){this.ne=a,this.ne.options.xhtml&&a.addEvent("get",this.cleanup.closure(this))},cleanup:function(a){var b=a.getElm(),c=this.toXHTML(b);a.content=c},toXHTML:function(a,b,c){var d="",e="",f="",g=a.nodeType,h=a.nodeName.toLowerCase(),i=a.hasChildNodes&&a.hasChildNodes(),j=new Array;switch(g){case 1:var k=a.attributes;switch(h){case"b":h="strong";break;case"i":h="em";break;case"font":h="span"}if(b){for(var l=0;l<k.length;l++){var m=k[l],n=m.nodeName.toLowerCase(),o=m.nodeValue;if(!m.specified||!o||bkLib.inArray(this.stripAttributes,n)||typeof o=="function")continue;switch(n){case"style":var p=o.replace(/ /g,"");for(itm in this.cssReplace)p.indexOf(itm)!=-1&&(j.push(this.cssReplace[itm]),p=p.replace(itm,""));f+=p,o="";break;case"class":o=o.replace("Apple-style-span","");break;case"size":f+="font-size:"+this.sizes[o]+";",o=""}o&&(e+=" "+n+'="'+o+'"')}f&&(e+=' style="'+f+'"');for(var l=0;l<j.length;l++)d+="<"+j[l]+">";e==""&&h=="span"&&(b=!1),b&&(d+="<"+h,h!="br"&&(d+=e))}if(!i&&!bkLib.inArray(this.noShort,n))b&&(d+=" />");else{b&&(d+=">");for(var l=0;l<a.childNodes.length;l++){var q=this.toXHTML(a.childNodes[l],!0,!0);q&&(d+=q)}}b&&i&&(d+="</"+h+">");for(var l=0;l<j.length;l++)d+="</"+j[l]+">";break;case 3:d+=a.nodeValue}return d}});nicEditors.registerPlugin(nicXHTML);var nicBBCode=bkClass.extend({construct:function(a){this.ne=a;if(this.ne.options.bbCode){a.addEvent("get",this.bbGet.closure(this)),a.addEvent("set",this.bbSet.closure(this));var b=this.ne.loadedPlugins;for(itm in b)b[itm].toXHTML&&(this.xhtml=b[itm])}},bbGet:function(a){var b=this.xhtml.toXHTML(a.getElm());a.content=this.toBBCode(b)},bbSet:function(a){a.content=this.fromBBCode(a.content)},toBBCode:function(a){function b(b,c){a=a.replace(b,c)}return b(/\n/gi,""),b(/<strong>(.*?)<\/strong>/gi,"[b]$1[/b]"),b(/<em>(.*?)<\/em>/gi,"[i]$1[/i]"),b(/<span.*?style="text-decoration:underline;">(.*?)<\/span>/gi,"[u]$1[/u]"),b(/<ul>(.*?)<\/ul>/gi,"[list]$1[/list]"),b(/<li>(.*?)<\/li>/gi,"[*]$1[/*]"),b(/<ol>(.*?)<\/ol>/gi,"[list=1]$1[/list]"),b(/<img.*?src="(.*?)".*?>/gi,"[img]$1[/img]"),b(/<a.*?href="(.*?)".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),b(/<br.*?>/gi,"\n"),b(/<.*?>.*?<\/.*?>/gi,""),a},fromBBCode:function(a){function b(b,c){a=a.replace(b,c)}return b(/\[b\](.*?)\[\/b\]/gi,"<strong>$1</strong>"),b(/\[i\](.*?)\[\/i\]/gi,"<em>$1</em>"),b(/\[u\](.*?)\[\/u\]/gi,'<span style="text-decoration:underline;">$1</span>'),b(/\[list\](.*?)\[\/list\]/gi,"<ul>$1</ul>"),b(/\[list=1\](.*?)\[\/list\]/gi,"<ol>$1</ol>"),b(/\[\*\](.*?)\[\/\*\]/gi,"<li>$1</li>"),b(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),b(/\[url=(.*?)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),b(/\n/gi,"<br />"),a}});nicEditors.registerPlugin(nicBBCode),nicEditor=nicEditor.extend({floatingPanel:function(){this.floating=(new bkElement("DIV")).setStyle({position:"absolute",top:"-1000px"}).appendTo(document.body),this.addEvent("focus",this.reposition.closure(this)).addEvent("blur",this.hide.closure(this)),this.setPanel(this.floating)},reposition:function(){var a=this.selectedInstance.e;this.floating.setStyle({width:(parseInt(a.getStyle("width"))||a.clientWidth)+"px"});var b=a.offsetTop-this.floating.offsetHeight;b<0&&(b=a.offsetTop+a.offsetHeight),this.floating.setStyle({top:b+"px",left:a.offsetLeft+"px",display:"block"})},hide:function(){this.floating.setStyle({top:"-1000px"})}});var nicCodeOptions={buttons:{xhtml:{name:"Edit HTML",type:"nicCodeButton"}}},nicCodeButton=nicEditorAdvancedButton.extend({width:"350px",addPane:function(){this.addForm({"":{type:"title",txt:"Edit HTML"},code:{type:"content",value:this.ne.selectedInstance.getContent(),style:{width:"340px",height:"200px"}}})},submit:function(a){var b=this.inputs.code.value;this.ne.selectedInstance.setContent(b),this.removePane()}});nicEditors.registerPlugin(nicPlugin,nicCodeOptions)
  85. ;function QASharedModel(){var a=this;a.ShowPopupCreateQuestion=function(){$.modal.close(),$("#popup-create-question").modal({persist:!0}),$("#simplemodal-container").css("width","680px"),$("#simplemodal-container").css("height","auto"),$("#simplemodal-container").css("background-color","#F9F9F9"),$(window).resize(),$("#btn-popup-create-question").show(),$("#btn-popup-update-question").hide()},a.CreateQuestion=function(){var a=$("#popup-create-question form");if(a.valid()){var b={title:$("#Title").val(),content:nicEditors.findEditor("Content").nicInstances[0].getContent(),categoryId:$("#CategoryId").val(),stateProvinceId:$("#StateProvinceId").val()};$.ajax({url:"/QA/InsertQuestion",data:JSON.stringify(b),type:"POST",contentType:"application/json",success:function(a){a.Message==null||a.Message==""?a.Result!=null&&a.Result!=""&&(window.location.href=a.Result):alert(a.Message)}})}},a.SetActiveMenu=function(){var a=document.URL.toLowerCase(),b="";a.indexOf("?")!==-1?b=a.split("?")[0]:b=a,b.endsWith("/rao-vat")?$(".qa-header-menu:eq(1)").addClass("active"):$(".qa-header-menu:eq(0)").addClass("active")},a.Init=function(){$(".btn-create-question").click(function(){var b=new Date;$.ajax({type:"GET",url:"/Common/IsLogin?"+b.getTime(),success:function(b){b.success==1?a.ShowPopupCreateQuestion():LoginPopup.Show(function(){a.ShowPopupCreateQuestion()},function(){})}})}),$("#btn-popup-create-question").click(function(){a.CreateQuestion()}),(new nicEditor({iconsPath:"http://static.foody.vn/Scripts/nicEdit/nicEditorIcons.gif",buttonList:["bold","italic","underline","image","link","unlink"],maxHeight:300})).panelInstance("Content"),$(".nicEdit-main").attr("spellcheck","false"),a.SetActiveMenu()}}var QASharedModel=new QASharedModel;$(function(){QASharedModel.Init()})
  86. ;(function(a){function b(){function b(a){var e=a<1e12?e=performance.now?performance.now()+performance.timing.navigationStart:Date.now():a||(new Date).getTime();e-d>=1e3&&(l._updateTargets(),d=e),c(b)}this.regional=[],this.regional[""]={labels:["Years","Months","Weeks","Days","Hours","Minutes","Seconds"],labels1:["Year","Month","Week","Day","Hour","Minute","Second"],compactLabels:["y","m","w"," day(s)"],whichLabels:null,digits:["0","1","2","3","4","5","6","7","8","9"],timeSeparator:":",isRTL:!1},this._defaults={until:null,since:null,timezone:null,serverSync:null,format:"dHMS",layout:"",compact:!1,significant:0,description:"",expiryUrl:"",expiryText:"",alwaysExpire:!1,onExpiry:null,onTick:null,tickInterval:1},a.extend(this._defaults,this.regional[""]),this._serverSyncs=[];var c=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null,d=0;!c||a.noRequestAnimationFrame?(a.noRequestAnimationFrame=null,setInterval(function(){l._updateTargets()},980)):(d=window.animationStartTime||window.webkitAnimationStartTime||window.mozAnimationStartTime||window.oAnimationStartTime||window.msAnimationStartTime||(new Date).getTime(),c(b))}function k(b,c){return b=="option"&&(c.length==0||c.length==1&&typeof c[0]=="string")?!0:a.inArray(b,j)>-1}var c=0,d=1,e=2,f=3,g=4,h=5,i=6;a.extend(b.prototype,{markerClassName:"hasCountdown",propertyName:"countdown",_rtlClass:"countdown_rtl",_sectionClass:"countdown_section",_amountClass:"countdown_amount",_rowClass:"countdown_row",_holdingClass:"countdown_holding",_showClass:"countdown_show",_descrClass:"countdown_descr",_timerTargets:[],setDefaults:function(b){this._resetExtraLabels(this._defaults,b),a.extend(this._defaults,b||{})},UTCDate:function(a,b,c,d,e,f,g,h){typeof b=="object"&&b.constructor==Date&&(h=b.getMilliseconds(),g=b.getSeconds(),f=b.getMinutes(),e=b.getHours(),d=b.getDate(),c=b.getMonth(),b=b.getFullYear());var i=new Date;return i.setUTCFullYear(b),i.setUTCDate(1),i.setUTCMonth(c||0),i.setUTCDate(d||1),i.setUTCHours(e||0),i.setUTCMinutes((f||0)-(Math.abs(a)<30?a*60:a)),i.setUTCSeconds(g||0),i.setUTCMilliseconds(h||0),i},periodsToSeconds:function(a){return a[0]*31557600+a[1]*2629800+a[2]*604800+a[3]*86400+a[4]*3600+a[5]*60+a[6]},_attachPlugin:function(b,c){b=a(b);if(b.hasClass(this.markerClassName))return;var d={options:a.extend({},this._defaults),_periods:[0,0,0,0,0,0,0]};b.addClass(this.markerClassName).data(this.propertyName,d),this._optionPlugin(b,c)},_addTarget:function(a){this._hasTarget(a)||this._timerTargets.push(a)},_hasTarget:function(b){return a.inArray(b,this._timerTargets)>-1},_removeTarget:function(b){this._timerTargets=a.map(this._timerTargets,function(a){return a==b?null:a})},_updateTargets:function(){for(var a=this._timerTargets.length-1;a>=0;a--)this._updateCountdown(this._timerTargets[a])},_optionPlugin:function(b,c,d){b=a(b);var e=b.data(this.propertyName);if(!c||typeof c=="string"&&d==null){var f=c;return c=(e||{}).options,c&&f?c[f]:c}if(!b.hasClass(this.markerClassName))return;c=c||{};if(typeof c=="string"){var f=c;c={},c[f]=d}this._resetExtraLabels(e.options,c),a.extend(e.options,c),this._adjustSettings(b,e);var g=new Date;(e._since&&e._since<g||e._until&&e._until>g)&&this._addTarget(b[0]),this._updateCountdown(b,e)},_updateCountdown:function(b,c){var d=a(b);c=c||d.data(this.propertyName);if(!c)return;d.html(this._generateHTML(c)).toggleClass(this._rtlClass,c.options.isRTL);if(a.isFunction(c.options.onTick)){var e=c._hold!="lap"?c._periods:this._calculatePeriods(c,c._show,c.options.significant,new Date);(c.options.tickInterval==1||this.periodsToSeconds(e)%c.options.tickInterval==0)&&c.options.onTick.apply(b,[e])}var f=c._hold!="pause"&&(c._since?c._now.getTime()<c._since.getTime():c._now.getTime()>=c._until.getTime());if(f&&!c._expiring){c._expiring=!0;if(this._hasTarget(b)||c.options.alwaysExpire){this._removeTarget(b),a.isFunction(c.options.onExpiry)&&c.options.onExpiry.apply(b,[]);if(c.options.expiryText){var g=c.options.layout;c.options.layout=c.options.expiryText,this._updateCountdown(b,c),c.options.layout=g}c.options.expiryUrl&&(window.location=c.options.expiryUrl)}c._expiring=!1}else c._hold=="pause"&&this._removeTarget(b);d.data(this.propertyName,c)},_resetExtraLabels:function(a,b){var c=!1;for(var d in b)if(d!="whichLabels"&&d.match(/[Ll]abels/)){c=!0;break}if(c)for(var d in a)d.match(/[Ll]abels[02-9]/)&&(a[d]=null)},_adjustSettings:function(b,c){var d,e=0,f=null;for(var g=0;g<this._serverSyncs.length;g++)if(this._serverSyncs[g][0]==c.options.serverSync){f=this._serverSyncs[g][1];break}if(f!=null)e=c.options.serverSync?f:0,d=new Date;else{var h=a.isFunction(c.options.serverSync)?c.options.serverSync.apply(b,[]):null;d=new Date,e=h?d.getTime()-h.getTime():0,this._serverSyncs.push([c.options.serverSync,e])}var i=c.options.timezone;i=i==null?-d.getTimezoneOffset():i,c._since=c.options.since,c._since!=null&&(c._since=this.UTCDate(i,this._determineTime(c._since,null)),c._since&&e&&c._since.setMilliseconds(c._since.getMilliseconds()+e)),c._until=this.UTCDate(i,this._determineTime(c.options.until,d)),e&&c._until.setMilliseconds(c._until.getMilliseconds()+e),c._show=this._determineShow(c)},_destroyPlugin:function(b){b=a(b);if(!b.hasClass(this.markerClassName))return;this._removeTarget(b[0]),b.removeClass(this.markerClassName).empty().removeData(this.propertyName)},_pausePlugin:function(a){this._hold(a,"pause")},_lapPlugin:function(a){this._hold(a,"lap")},_resumePlugin:function(a){this._hold(a,null)},_hold:function(b,c){var d=a.data(b,this.propertyName);if(d){if(d._hold=="pause"&&!c){d._periods=d._savePeriods;var e=d._since?"-":"+";d[d._since?"_since":"_until"]=this._determineTime(e+d._periods[0]+"y"+e+d._periods[1]+"o"+e+d._periods[2]+"w"+e+d._periods[3]+"d"+e+d._periods[4]+"h"+e+d._periods[5]+"m"+e+d._periods[6]+"s"),this._addTarget(b)}d._hold=c,d._savePeriods=c=="pause"?d._periods:null,a.data(b,this.propertyName,d),this._updateCountdown(b,d)}},_getTimesPlugin:function(b){var c=a.data(b,this.propertyName);return c?c._hold?this._calculatePeriods(c,c._show,c.options.significant,new Date):c._periods:null},_determineTime:function(a,b){var c=function(a){var b=new Date;return b.setTime(b.getTime()+a*1e3),b},d=function(a){a=a.toLowerCase();var b=new Date,c=b.getFullYear(),d=b.getMonth(),e=b.getDate(),f=b.getHours(),g=b.getMinutes(),h=b.getSeconds(),i=/([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g,j=i.exec(a);while(j){switch(j[2]||"s"){case"s":h+=parseInt(j[1],10);break;case"m":g+=parseInt(j[1],10);break;case"h":f+=parseInt(j[1],10);break;case"d":e+=parseInt(j[1],10);break;case"w":e+=parseInt(j[1],10)*7;break;case"o":d+=parseInt(j[1],10),e=Math.min(e,l._getDaysInMonth(c,d));break;case"y":c+=parseInt(j[1],10),e=Math.min(e,l._getDaysInMonth(c,d))}j=i.exec(a)}return new Date(c,d,e,f,g,h,0)},e=a==null?b:typeof a=="string"?d(a):typeof a=="number"?c(a):a;return e&&e.setMilliseconds(0),e},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_normalLabels:function(a){return a},_generateHTML:function(b){var j=this;b._periods=b._hold?b._periods:this._calculatePeriods(b,b._show,b.options.significant,new Date);var k=!1,m=0,n=b.options.significant,o=a.extend({},b._show);for(var p=c;p<=i;p++)k|=b._show[p]=="?"&&b._periods[p]>0,o[p]=b._show[p]=="?"&&!k?null:b._show[p],m+=o[p]?1:0,n-=b._periods[p]>0?1:0;var q=[!1,!1,!1,!1,!1,!1,!1];for(var p=i;p>=c;p--)b._show[p]&&(b._periods[p]?q[p]=!0:(q[p]=n>0,n--));var r=b.options.compact?b.options.compactLabels:b.options.labels,s=b.options.whichLabels||this._normalLabels,t=function(a){var c=b.options["compactLabels"+s(b._periods[a])];return o[a]?j._translateDigits(b,b._periods[a])+(c?c[a]:r[a])+" ":""},u=function(a){var c=b.options["labels"+s(b._periods[a])];return!b.options.significant&&o[a]||b.options.significant&&q[a]?'<span class="'+l._sectionClass+'">'+'<span class="'+l._amountClass+'">'+j._translateDigits(b,b._periods[a])+"</span><br/>"+(c?c[a]:r[a])+"</span>":""};return b.options.layout?this._buildLayout(b,o,b.options.layout,b.options.compact,b.options.significant,q):(b.options.compact?'<span class="'+this._rowClass+" "+this._amountClass+(b._hold?" "+this._holdingClass:"")+'">'+t(c)+t(d)+t(e)+t(f)+(o[g]?this._minDigits(b,b._periods[g],2):"")+(o[h]?(o[g]?b.options.timeSeparator:"")+this._minDigits(b,b._periods[h],2):"")+(o[i]?(o[g]||o[h]?b.options.timeSeparator:"")+this._minDigits(b,b._periods[i],2):""):'<span class="'+this._rowClass+" "+this._showClass+(b.options.significant||m)+(b._hold?" "+this._holdingClass:"")+'">'+u(c)+u(d)+u(e)+u(f)+u(g)+u(h)+u(i))+"</span>"+(b.options.description?'<span class="'+this._rowClass+" "+this._descrClass+'">'+b.options.description+"</span>":"")},_buildLayout:function(b,j,k,l,m,n){var o=b.options[l?"compactLabels":"labels"],p=b.options.whichLabels||this._normalLabels,q=function(a){return(b.options[(l?"compactLabels":"labels")+p(b._periods[a])]||o)[a]},r=function(a,c){return b.options.digits[Math.floor(a/c)%10]},s={desc:b.options.description,sep:b.options.timeSeparator,yl:q(c),yn:this._minDigits(b,b._periods[c],1),ynn:this._minDigits(b,b._periods[c],2),ynnn:this._minDigits(b,b._periods[c],3),y1:r(b._periods[c],1),y10:r(b._periods[c],10),y100:r(b._periods[c],100),y1000:r(b._periods[c],1e3),ol:q(d),on:this._minDigits(b,b._periods[d],1),onn:this._minDigits(b,b._periods[d],2),onnn:this._minDigits(b,b._periods[d],3),o1:r(b._periods[d],1),o10:r(b._periods[d],10),o100:r(b._periods[d],100),o1000:r(b._periods[d],1e3),wl:q(e),wn:this._minDigits(b,b._periods[e],1),wnn:this._minDigits(b,b._periods[e],2),wnnn:this._minDigits(b,b._periods[e],3),w1:r(b._periods[e],1),w10:r(b._periods[e],10),w100:r(b._periods[e],100),w1000:r(b._periods[e],1e3),dl:q(f),dn:this._minDigits(b,b._periods[f],1),dnn:this._minDigits(b,b._periods[f],2),dnnn:this._minDigits(b,b._periods[f],3),d1:r(b._periods[f],1),d10:r(b._periods[f],10),d100:r(b._periods[f],100),d1000:r(b._periods[f],1e3),hl:q(g),hn:this._minDigits(b,b._periods[g],1),hnn:this._minDigits(b,b._periods[g],2),hnnn:this._minDigits(b,b._periods[g],3),h1:r(b._periods[g],1),h10:r(b._periods[g],10),h100:r(b._periods[g],100),h1000:r(b._periods[g],1e3),ml:q(h),mn:this._minDigits(b,b._periods[h],1),mnn:this._minDigits(b,b._periods[h],2),mnnn:this._minDigits(b,b._periods[h],3),m1:r(b._periods[h],1),m10:r(b._periods[h],10),m100:r(b._periods[h],100),m1000:r(b._periods[h],1e3),sl:q(i),sn:this._minDigits(b,b._periods[i],1),snn:this._minDigits(b,b._periods[i],2),snnn:this._minDigits(b,b._periods[i],3),s1:r(b._periods[i],1),s10:r(b._periods[i],10),s100:r(b._periods[i],100),s1000:r(b._periods[i],1e3)},t=k;for(var u=c;u<=i;u++){var v="yowdhms".charAt(u),w=new RegExp("\\{"+v+"<\\}(.*)\\{"+v+">\\}","g");t=t.replace(w,!m&&j[u]||m&&n[u]?"$1":"")}return a.each(s,function(a,b){var c=new RegExp("\\{"+a+"\\}","g");t=t.replace(c,b)}),t},_minDigits:function(a,b,c){return b=""+b,b.length>=c?this._translateDigits(a,b):(b="0000000000"+b,this._translateDigits(a,b.substr(b.length-c)))},_translateDigits:function(a,b){return(""+b).replace(/[0-9]/g,function(b){return a.options.digits[b]})},_determineShow:function(a){var b=a.options.format,j=[];return j[c]=b.match("y")?"?":b.match("Y")?"!":null,j[d]=b.match("o")?"?":b.match("O")?"!":null,j[e]=b.match("w")?"?":b.match("W")?"!":null,j[f]=b.match("d")?"?":b.match("D")?"!":null,j[g]=b.match("h")?"?":b.match("H")?"!":null,j[h]=b.match("m")?"?":b.match("M")?"!":null,j[i]=b.match("s")?"?":b.match("S")?"!":null,j},_calculatePeriods:function(a,b,j,k){a._now=k,a._now.setMilliseconds(0);var m=new Date(a._now.getTime());a._since?k.getTime()<a._since.getTime()?a._now=k=m:k=a._since:(m.setTime(a._until.getTime()),k.getTime()>a._until.getTime()&&(a._now=k=m));var n=[0,0,0,0,0,0,0];if(b[c]||b[d]){var o=l._getDaysInMonth(k.getFullYear(),k.getMonth()),p=l._getDaysInMonth(m.getFullYear(),m.getMonth()),q=m.getDate()==k.getDate()||m.getDate()>=Math.min(o,p)&&k.getDate()>=Math.min(o,p),r=function(a){return(a.getHours()*60+a.getMinutes())*60+a.getSeconds()},s=Math.max(0,(m.getFullYear()-k.getFullYear())*12+m.getMonth()-k.getMonth()+(m.getDate()<k.getDate()&&!q||q&&r(m)<r(k)?-1:0));n[c]=b[c]?Math.floor(s/12):0,n[d]=b[d]?s-n[c]*12:0,k=new Date(k.getTime());var t=k.getDate()==o,u=l._getDaysInMonth(k.getFullYear()+n[c],k.getMonth()+n[d]);k.getDate()>u&&k.setDate(u),k.setFullYear(k.getFullYear()+n[c]),k.setMonth(k.getMonth()+n[d]),t&&k.setDate(u)}var v=Math.floor((m.getTime()-k.getTime())/1e3),w=function(a,c){n[a]=b[a]?Math.floor(v/c):0,v-=n[a]*c};w(e,604800),w(f,86400),w(g,3600),w(h,60),w(i,1);if(v>0&&!a._since){var x=[1,12,4.3482,7,24,60,60],y=i,z=1;for(var A=i;A>=c;A--)b[A]&&(n[y]>=z&&(n[y]=0,v=1),v>0&&(n[A]++,v=0,y=A,z=1)),z*=x[A]}if(j)for(var A=c;A<=i;A++)j&&n[A]?j--:j||(n[A]=0);return n}});var j=["getTimes"];a.fn.countdown=function(a){var b=Array.prototype.slice.call(arguments,1);return k(a,b)?l["_"+a+"Plugin"].apply(l,[this[0]].concat(b)):this.each(function(){if(typeof a=="string"){if(!l["_"+a+"Plugin"])throw"Unknown command: "+a;l["_"+a+"Plugin"].apply(l,[this].concat(b))}else l._attachPlugin(this,a||{})})};var l=a.countdown=new b})(jQuery)
  87. ;(function(a){a.countdown.regional.vi={labels:["Năm","Tháng","Tuần","Ngà y","Giờ","Phút","Giây"],labels1:["Năm","Tháng","Tuần","Ngà y","Giờ","Phút","Giây"],compactLabels:["năm","th","tu"," ngà y"],whichLabels:null,digits:["0","1","2","3","4","5","6","7","8","9"],timeSeparator:":",isRTL:!1}})(jQuery)
  88. ;var ListUserLikeModel=function(){var a=this;a.applyUserModel=function(a){if(a!=null&&a.length>0)for(var b=0;b<a.length;b++)a[b].FriendStatusId=ko.observable(a[b].FriendStatusId);return a},a.users=ko.observableArray([]),a.isloading=ko.observable(!1),a.load=function(b,c){if(!a.isloading()){a.users.removeAll(),$("#user-like-popup").modal({persist:!0}),$("#simplemodal-container").css("height","440px"),$("#simplemodal-container").css("width","500px"),$(window).resize(),a.isloading(!0);var d=new Date;$.get("/likecomment/GetLikeUsers?t="+d.getTime()+"&referenceid="+b+"&type="+c,function(b){if(b.success){var c=b.data;a.users(a.applyUserModel(c)),a.isloading(!1)}else a.isloading(!1)})}},a.addFriend=function(a){var b=a.UserID,c={friendid:b};$.post("/friend/addfriend?nonHtml=true",c,function(b){if(b.success)a.FriendStatusId(parseInt(b.html));else switch(b.errorType){case 1:loginSuccessCallback=function(){$.modal.close(),window.location=window.location.href},LoginPopup.Show();break;default:}})},a.cancelAddFriend=function(a){var b=a.UserID,c={friendid:b};$.post("/friend/canceladdfriend?nonHtml=true",c,function(b){b.success&&a.FriendStatusId(parseInt(b.html))})},a.acceptFriendRequest=function(a){var b=a.UserID,c={friendid:b};$.post("/friend/acceptaddfriend?nonHtml=true",c,function(b){b.success&&a.FriendStatusId(parseInt(b.html))})},a.removeFriend=function(a){if(confirm("Bạn thực sự muốn hủy kết bạn?")){var b=a.UserID,c={friendid:b};$.post("/friend/removefriend?nonHtml=true",c,function(b){b.success&&a.FriendStatusId(parseInt(b.html))})}}},listUserLikeModel=new ListUserLikeModel;$(function(){$("#users-like-div").length>0&&ko.applyBindings(listUserLikeModel,document.getElementById("users-like-div"))}),$(".totaluserlike").live("click",function(){var a=$(this).attr("refId"),b=$(this).attr("reftype");listUserLikeModel.load(a,b)})
  89. ;jQuery&&function(a){function b(b,e){var f=b?a(this):e,g=a(f.attr("data-dropdown")),h=f.hasClass("dropdown-open");if(b){if(a(b.target).hasClass("dropdown-ignore"))return;b.preventDefault(),b.stopPropagation()}else if(f!==e.target&&a(e.target).hasClass("dropdown-ignore"))return;c();if(h||f.hasClass("dropdown-disabled"))return;f.addClass("dropdown-open"),g.data("dropdown-trigger",f).show(),d(),g.trigger("show",{dropdown:g,trigger:f})}function c(b){var c=b?a(b.target).parents().addBack():null;if(c&&c.is(".dropdown")){if(!c.is(".dropdown-menu"))return;if(!c.is("A"))return}a(document).find(".dropdown:visible").each(function(){var b=a(this);b.hide().removeData("dropdown-trigger").trigger("hide",{dropdown:b})}),a(document).find(".dropdown-open").removeClass("dropdown-open")}function d(){var b=a(".dropdown:visible").eq(0),c=b.data("dropdown-trigger"),d=c?parseInt(c.attr("data-horizontal-offset")||0,10):null,e=c?parseInt(c.attr("data-vertical-offset")||0,10):null;if(b.length===0||!c)return;b.hasClass("dropdown-relative")?b.css({left:b.hasClass("dropdown-anchor-right")?c.position().left-(b.outerWidth(!0)-c.outerWidth(!0))-parseInt(c.css("margin-right"),10)+d:c.position().left+parseInt(c.css("margin-left"),10)+d,top:c.position().top+c.outerHeight(!0)-parseInt(c.css("margin-top"),10)+e}):b.css({left:b.hasClass("dropdown-anchor-right")?c.offset().left-(b.outerWidth()-c.outerWidth())+d:c.offset().left+d,top:c.offset().top+c.outerHeight()+e})}a.extend(a.fn,{jdropdown:function(d,e){switch(d){case"show":return b(null,a(this)),a(this);case"hide":return c(),a(this);case"attach":return a(this).attr("data-dropdown",e);case"detach":return c(),a(this).removeAttr("data-dropdown");case"disable":return a(this).addClass("dropdown-disabled");case"enable":return c(),a(this).removeClass("dropdown-disabled")}}}),a(document).on("click.dropdown","[data-dropdown]",b),a(document).on("click.dropdown",c),a(window).on("resize",d)}(jQuery)
  90. ;function PopupEditAvatarStatusModel(){var a=this;a.AvatarId=ko.observable(),a.Status=ko.observable(),a.Show=function(){var b={avatarId:a.AvatarId()};$.ajax({url:"/Account/GetDetailStatus",data:JSON.stringify(b),type:"POST",contentType:"application/json",success:function(b){b.Message==null||b.Message==""?a.Status(b.Result.Status):alert(b.Message)}}),$.modal.close(),$("#popup-edit-status").modal({persist:!0}),$("#simplemodal-container").css("width","680px"),$("#simplemodal-container").css("height","auto"),$("#simplemodal-container").css("background-color","#F9F9F9"),$(window).resize()},a.SaveStatus=function(){var b={avatarId:a.AvatarId(),status:a.Status()};$.ajax({url:"/Account/EditStatus",data:JSON.stringify(b),type:"POST",contentType:"application/json",success:function(a){a.Message==null||a.Message==""?(alert("Bạn đã cập nhật thà nh công."),window.location.reload()):alert(a.Message)}})},a.Init=function(){ko.applyBindings(a,$("#popup-edit-status")[0]),$("#btn-edit-status").click(function(){a.SaveStatus()})}}
  91. ;/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
  92. (function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20,
  93. width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},
  94. keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+
  95. (I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,
  96. openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
  97. isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,
  98. c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&
  99. k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||
  100. b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=
  101. setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current;
  102. d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d=
  103. a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")),
  104. b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(),
  105. y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement;
  106. if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&&
  107. (h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0,
  108. {},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,
  109. mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=
  110. !0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");
  111. "image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload=
  112. this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);
  113. f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,
  114. e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,
  115. outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}",
  116. g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll":
  117. "no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside?
  118. h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth||
  119. h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&&
  120. "iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width();
  121. y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&&
  122. !a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(),
  123. b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a=
  124. a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):
  125. (c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"===
  126. f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c,
  127. {duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=
  128. b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay=
  129. f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?
  130. b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth),
  131. p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"===
  132. f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=
  133. b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,
  134. e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+
  135. ":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20===
  136. d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery);
  137. ;(function(a){var b=a.fancybox;b.helpers.buttons={defaults:{skipSingle:!1,position:"top",tpl:'<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:;"></a></li></ul></div>'},list:null,buttons:null,beforeLoad:function(a,b){if(a.skipSingle&&b.group.length<2){b.helpers.buttons=!1,b.closeBtn=!0;return}b.margin[a.position==="bottom"?2:0]+=30},onPlayStart:function(){this.buttons&&this.buttons.play.attr("title","Pause slideshow").addClass("btnPlayOn")},onPlayEnd:function(){this.buttons&&this.buttons.play.attr("title","Start slideshow").removeClass("btnPlayOn")},afterShow:function(c,d){var e=this.buttons;e||(this.list=a(c.tpl).addClass(c.position).appendTo("body"),e={prev:this.list.find(".btnPrev").click(b.prev),next:this.list.find(".btnNext").click(b.next),play:this.list.find(".btnPlay").click(b.play),toggle:this.list.find(".btnToggle").click(b.toggle),close:this.list.find(".btnClose").click(b.close)}),d.index>0||d.loop?e.prev.removeClass("btnDisabled"):e.prev.addClass("btnDisabled"),d.loop||d.index<d.group.length-1?(e.next.removeClass("btnDisabled"),e.play.removeClass("btnDisabled")):(e.next.addClass("btnDisabled"),e.play.addClass("btnDisabled")),this.buttons=e,this.onUpdate(c,d)},onUpdate:function(a,b){var c;if(!this.buttons)return;c=this.buttons.toggle.removeClass("btnDisabled btnToggleOn"),b.canShrink?c.addClass("btnToggleOn"):b.canExpand||c.addClass("btnDisabled")},beforeClose:function(){this.list&&this.list.remove(),this.list=null,this.buttons=null}}})(jQuery)
  138. ;(function(a){"use strict";var b=a.fancybox,c=function(b,c,d){return d=d||"",a.type(d)==="object"&&(d=a.param(d,!0)),a.each(c,function(a,c){b=b.replace("$"+a,c||"")}),d.length&&(b+=(b.indexOf("?")>0?"&":"?")+d),b};b.helpers.media={defaults:{youtube:{matcher:/(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"opaque",enablejsapi:1},type:"iframe",url:"//www.youtube.com/embed/$3"},vimeo:{matcher:/(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},type:"iframe",url:"//player.vimeo.com/video/$1"},metacafe:{matcher:/metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/,params:{autoPlay:"yes"},type:"swf",url:function(b,c,d){return d.swf.flashVars="playerVars="+a.param(c,!0),"//www.metacafe.com/fplayer/"+b[1]+"/.swf"}},dailymotion:{matcher:/dailymotion.com\/video\/(.*)\/?(.*)/,params:{additionalInfos:0,autoStart:1},type:"swf",url:"//www.dailymotion.com/swf/video/$1"},twitvid:{matcher:/twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i,params:{autoplay:0},type:"iframe",url:"//www.twitvid.com/embed.php?guid=$1"},twitpic:{matcher:/twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i,type:"image",url:"//twitpic.com/show/full/$1/"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},google_maps:{matcher:/maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i,type:"iframe",url:function(a){return"//maps.google."+a[1]+"/"+a[3]+""+a[4]+"&output="+(a[4].indexOf("layer=c")>0?"svembed":"embed")}}},beforeLoad:function(b,d){var e=d.href||"",f=!1,g,h,i,j;for(g in b)if(b.hasOwnProperty(g)){h=b[g],i=e.match(h.matcher);if(i){f=h.type,j=a.extend(!0,{},h.params,d[g]||(a.isPlainObject(b[g])?b[g].params:null)),e=a.type(h.url)==="function"?h.url.call(this,i,j,d):c(h.url,i,j);break}}f&&(d.href=e,d.type=f,d.autoHeight=!1)}}})(jQuery)
  139. ;(function(a){var b=a.fancybox;b.helpers.thumbs={defaults:{width:50,height:50,position:"bottom",source:function(b){var c;return b.element&&(c=a(b.element).find("img").attr("src")),!c&&b.type==="image"&&b.href&&(c=b.href),c}},wrap:null,list:null,width:0,init:function(b,c){var d=this,e,f=b.width,g=b.height,h=b.source;e="";for(var i=0;i<c.group.length;i++)e+='<li><a style="width:'+f+"px;height:"+g+'px;" href="javascript:jQuery.fancybox.jumpto('+i+');"></a></li>';this.wrap=a('<div id="fancybox-thumbs"></div>').addClass(b.position).appendTo("body"),this.list=a("<ul>"+e+"</ul>").appendTo(this.wrap),a.each(c.group,function(b){var e=h(c.group[b]);if(!e)return;a("<img />").load(function(){var c=this.width,e=this.height,h,i,j;if(!d.list||!c||!e)return;h=c/f,i=e/g,j=d.list.children().eq(b).find("a"),h>=1&&i>=1&&(h>i?(c=Math.floor(c/i),e=g):(c=f,e=Math.floor(e/h))),a(this).css({width:c,height:e,top:Math.floor(g/2-e/2),left:Math.floor(f/2-c/2)}),j.width(f).height(g),a(this).hide().appendTo(j).fadeIn(300)}).attr("src",e)}),this.width=this.list.children().eq(0).outerWidth(!0),this.list.width(this.width*(c.group.length+1)).css("left",Math.floor(a(window).width()*.5-(c.index*this.width+this.width*.5)))},beforeLoad:function(a,b){if(b.group.length<2){b.helpers.thumbs=!1;return}b.margin[a.position==="top"?0:2]+=a.height+15},afterShow:function(a,b){this.list?this.onUpdate(a,b):this.init(a,b),this.list.children().removeClass("active").eq(b.index).addClass("active")},onUpdate:function(b,c){this.list&&this.list.stop(!0).animate({left:Math.floor(a(window).width()*.5-(c.index*this.width+this.width*.5))},150)},beforeClose:function(){this.wrap&&this.wrap.remove(),this.wrap=null,this.list=null,this.width=0}}})(jQuery)
RAW Paste Data
Top