function animEvent(n,t,i){for(var r=0;r<pfx.length;r++)pfx[r]||(t=t.toLowerCase()),n.addEventListener(pfx[r]+t,i,!1)}function animationStart(n,t){animEvent(n,"AnimationStart",t)}function animationIteration(n,t){animEvent(el,"AnimationIteration",t)}function animationEnd(n,t){animEvent(n,"AnimationEnd",t)}function ClientStorage(n,t,i){var u,r=this;return r.databaseName=n,r.tableName=t,r.columns=i,r.init=function(){u=new localStorageDB(r.databaseName,localStorage);u.isNew()&&r.tableName&&r.columns&&(u.createTable(r.tableName,r.columns),u.commit())},r.insert=function(n){u.insert(r.tableName,n);u.commit()},r.insertArray=function(n){if(n&&n.length){for(var t=0;t<n.length;t++)u.insert(r.tableName,n[t]);u.commit()}},r.update=function(n,t){u.insertOrUpdate(r.tableName,n,t);u.commit()},r.query=function(n){return u.query(r.tableName,n)},r.unique=function(n){var t=r.query(n);return t.length?t[0]:null},r.delete=function(n){u.deleteRows(r.tableName,n);u.commit()},r.deleteAll=function(){u.deleteRows(r.tableName);u.commit()},r.rowCount=function(){return u.rowCount(r.tableName)},r.dropTable=function(){u.dropTable();u.commit()},r}function getCookie(n){if(document.cookie.length>0){var t=document.cookie.indexOf(n+"="),i;if(t!=-1)return t=t+n.length+1,i=document.cookie.indexOf(";",t),i==-1&&(i=document.cookie.length),unescape(document.cookie.substring(t,i))}return""}function setCookie(n,t,i){var f="",r,u,e;i!=null&&(r=new Date,r.setDate(r.getDate()+i),f=";expires="+r.toGMTString());u=$.trim($("#moblie_web_domain").val());e=u==null||u==""?"":";domain="+u;document.cookie=n+"="+escape(t)+";path=/;"+f+e}function Pref(){var n=this;n.countryEl=$("#pref_country");n.currecyEl=$("#pref_currency");n.languageEl=$("#pref_language");n.finishEl=$("#submit_pref");n.check=function(){return!!n.countryEl.val()&&!!n.currecyEl.val()&&!!n.languageEl.val()};n.finish=function(){n.finishEl.on("click",function(){var i,r,t,u;n.check()&&(i=n.languageEl.val(),r=i==defaultLang?"":i,setCookie(cookieLang,i,730),setCookie(cookieConutry,n.countryEl.val(),730),setCookie(cookieCurrency,n.currecyEl.val(),730),t=getCookie(kReturnUrl),t&&t.length>3?(u=new RegExp("^/[a-zA-Z]{2}/","i"),u.test(t)&&(t=t.replace(u,"/")),t=(r?"/"+r:"")+t):t="/"+r,setCookie(kReturnUrl,t,1),setTimeout(function(){location.href=t},300))})}}var Zepto=function(){function v(n){return null==n?String(n):ot[oi.call(n)]||"object"}function s(n){return"function"==v(n)}function nt(n){return null!=n&&n==n.window}function b(n){return null!=n&&n.nodeType==n.DOCUMENT_NODE}function l(n){return"object"==v(n)}function y(n){return l(n)&&!nt(n)&&Object.getPrototypeOf(n)==Object.prototype}function tt(n){return"number"==typeof n.length}function kt(n){return w.call(n,function(n){return null!=n})}function dt(t){return t.length>0?n.fn.concat.apply([],t):t}function p(n){return n.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function st(n){return n in ut?ut[n]:ut[n]=new RegExp("(^|\\s)"+n+"(\\s|$)")}function ht(n,t){return"number"!=typeof t||ni[p(n)]?t:t+"px"}function gt(n){var t,i;return rt[n]||(t=r.createElement(n),r.body.appendChild(t),i=getComputedStyle(t,"").getPropertyValue("display"),t.parentNode.removeChild(t),"none"==i&&(i="block"),rt[n]=i),rt[n]}function ct(t){return"children"in t?h.call(t.children):n.map(t.childNodes,function(n){if(1==n.nodeType)return n})}function lt(n,t,r){for(i in t)r&&(y(t[i])||a(t[i]))?(y(t[i])&&!y(n[i])&&(n[i]={}),a(t[i])&&!a(n[i])&&(n[i]=[]),lt(n[i],t[i],r)):t[i]!==u&&(n[i]=t[i])}function k(t,i){return null==i?n(t):n(t).filter(i)}function e(n,t,i,r){return s(t)?t.call(n,i,r):t}function it(n,t,i){null==i?n.removeAttribute(t):n.setAttribute(t,i)}function c(n,t){var i=n.className||"",r=i&&i.baseVal!==u;return t===u?r?i.baseVal:i:void(r?i.baseVal=t:n.className=t)}function at(t){var i;try{return t?"true"==t||("false"==t?!1:"null"==t?null:/^0/.test(t)||isNaN(i=Number(t))?/^[\[\{]/.test(t)?n.parseJSON(t):t:i):t}catch(r){return t}}function vt(n,t){t(n);for(var i=0,r=n.childNodes.length;r>i;i++)vt(n.childNodes[i],t)}var u,i,n,o,d,g,f=[],h=f.slice,w=f.filter,r=window.document,rt={},ut={},ni={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},ft=/^\s*<(\w+|!)[^>]*>/,ti=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ii=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,yt=/^(?:body|html)$/i,ri=/([A-Z])/g,ui=["val","css","html","text","data","width","height","offset"],et=r.createElement("table"),pt=r.createElement("tr"),wt={tr:r.createElement("tbody"),tbody:et,thead:et,tfoot:et,td:pt,th:pt,"*":r.createElement("div")},fi=/complete|loaded|interactive/,ei=/^[\w-]*$/,ot={},oi=ot.toString,t={},bt=r.createElement("div"),si={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},a=Array.isArray||function(n){return n instanceof Array};return t.matches=function(n,i){var u,e,r,f;return!i||!n||1!==n.nodeType?!1:(u=n.webkitMatchesSelector||n.mozMatchesSelector||n.oMatchesSelector||n.matchesSelector,u)?u.call(n,i):(r=n.parentNode,f=!r,f&&(r=bt).appendChild(n),e=~t.qsa(r,i).indexOf(n),f&&bt.removeChild(n),e)},d=function(n){return n.replace(/-+(.)?/g,function(n,t){return t?t.toUpperCase():""})},g=function(n){return w.call(n,function(t,i){return n.indexOf(t)==i})},t.fragment=function(t,i,f){var e,s,o;return ti.test(t)&&(e=n(r.createElement(RegExp.$1))),e||(t.replace&&(t=t.replace(ii,"<$1><\/$2>")),i===u&&(i=ft.test(t)&&RegExp.$1),i in wt||(i="*"),o=wt[i],o.innerHTML=""+t,e=n.each(h.call(o.childNodes),function(){o.removeChild(this)})),y(f)&&(s=n(e),n.each(f,function(n,t){ui.indexOf(n)>-1?s[n](t):s.attr(n,t)})),e},t.Z=function(t,i){return t=t||[],t.__proto__=n.fn,t.selector=i||"",t},t.isZ=function(n){return n instanceof t.Z},t.init=function(i,f){var e;if(!i)return t.Z();if("string"==typeof i)if(i=i.trim(),"<"==i[0]&&ft.test(i))e=t.fragment(i,RegExp.$1,f),i=null;else{if(f!==u)return n(f).find(i);e=t.qsa(r,i)}else{if(s(i))return n(r).ready(i);if(t.isZ(i))return i;if(a(i))e=kt(i);else if(l(i))e=[i],i=null;else if(ft.test(i))e=t.fragment(i.trim(),RegExp.$1,f),i=null;else{if(f!==u)return n(f).find(i);e=t.qsa(r,i)}}return t.Z(e,i)},n=function(n,i){return t.init(n,i)},n.extend=function(n){var t,i=h.call(arguments,1);return"boolean"==typeof n&&(t=n,n=i.shift()),i.forEach(function(i){lt(n,i,t)}),n},t.qsa=function(n,t){var u,i="#"==t[0],f=!i&&"."==t[0],r=i||f?t.slice(1):t,e=ei.test(r);return b(n)&&e&&i?(u=n.getElementById(r))?[u]:[]:1!==n.nodeType&&9!==n.nodeType?[]:h.call(e&&!i?f?n.getElementsByClassName(r):n.getElementsByTagName(t):n.querySelectorAll(t))},n.contains=r.documentElement.contains?function(n,t){return n!==t&&n.contains(t)}:function(n,t){for(;t&&(t=t.parentNode);)if(t===n)return!0;return!1},n.type=v,n.isFunction=s,n.isWindow=nt,n.isArray=a,n.isPlainObject=y,n.isEmptyObject=function(n){var t;for(t in n)return!1;return!0},n.inArray=function(n,t,i){return f.indexOf.call(t,n,i)},n.camelCase=d,n.trim=function(n){return null==n?"":String.prototype.trim.call(n)},n.uuid=0,n.support={},n.expr={},n.map=function(n,t){var i,r,u,f=[];if(tt(n))for(r=0;r<n.length;r++)i=t(n[r],r),null!=i&&f.push(i);else for(u in n)i=t(n[u],u),null!=i&&f.push(i);return dt(f)},n.each=function(n,t){var i,r;if(tt(n)){for(i=0;i<n.length;i++)if(t.call(n[i],i,n[i])===!1)return n}else for(r in n)if(t.call(n[r],r,n[r])===!1)return n;return n},n.grep=function(n,t){return w.call(n,t)},window.JSON&&(n.parseJSON=JSON.parse),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(n,t){ot["[object "+t+"]"]=t.toLowerCase()}),n.fn={forEach:f.forEach,reduce:f.reduce,push:f.push,sort:f.sort,indexOf:f.indexOf,concat:f.concat,map:function(t){return n(n.map(this,function(n,i){return t.call(n,i,n)}))},slice:function(){return n(h.apply(this,arguments))},ready:function(t){return fi.test(r.readyState)&&r.body?t(n):r.addEventListener("DOMContentLoaded",function(){t(n)},!1),this},get:function(n){return n===u?h.call(this):this[n>=0?n:n+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(n){return f.every.call(this,function(t,i){return n.call(t,i,t)!==!1}),this},filter:function(i){return s(i)?this.not(this.not(i)):n(w.call(this,function(n){return t.matches(n,i)}))},add:function(t,i){return n(g(this.concat(n(t,i))))},is:function(n){return this.length>0&&t.matches(this[0],n)},not:function(t){var i=[],r;return s(t)&&t.call!==u?this.each(function(n){t.call(this,n)||i.push(this)}):(r="string"==typeof t?this.filter(t):tt(t)&&s(t.item)?h.call(t):n(t),this.forEach(function(n){r.indexOf(n)<0&&i.push(n)})),n(i)},has:function(t){return this.filter(function(){return l(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(n){return-1===n?this.slice(n):this.slice(n,+n+1)},first:function(){var t=this[0];return t&&!l(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!l(t)?t:n(t)},find:function(i){var r=this;return i?"object"==typeof i?n(i).filter(function(){var t=this;return f.some.call(r,function(i){return n.contains(i,t)})}):1==this.length?n(t.qsa(this[0],i)):this.map(function(){return t.qsa(this,i)}):[]},closest:function(i,r){var u=this[0],f=!1;for("object"==typeof i&&(f=n(i));u&&!(f?f.indexOf(u)>=0:t.matches(u,i));)u=u!==r&&!b(u)&&u.parentNode;return n(u)},parents:function(t){for(var i=[],r=this;r.length>0;)r=n.map(r,function(n){if((n=n.parentNode)&&!b(n)&&i.indexOf(n)<0)return(i.push(n),n)});return k(i,t)},parent:function(n){return k(g(this.pluck("parentNode")),n)},children:function(n){return k(this.map(function(){return ct(this)}),n)},contents:function(){return this.map(function(){return h.call(this.childNodes)})},siblings:function(n){return k(this.map(function(n,t){return w.call(ct(t.parentNode),function(n){return n!==t})}),n)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(n){return n[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display="");"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=gt(this.nodeName))})},replaceWith:function(n){return this.before(n).remove()},wrap:function(t){var r=s(t),i,u;return this[0]&&!r&&(i=n(t).get(0),u=i.parentNode||this.length>1),this.each(function(f){n(this).wrapAll(r?t.call(this,f):u?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var i;(i=t.children()).length;)t=i.first();n(t).append(this)}return this},wrapInner:function(t){var i=s(t);return this.each(function(r){var u=n(this),f=u.contents(),e=i?t.call(this,r):t;f.length?f.wrapAll(e):u.append(e)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var i=n(this);(t===u?"none"==i.css("display"):t)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(i){var r=this.innerHTML;n(this).empty().append(e(this,t,i,r))}):0 in this?this[0].innerHTML:null},text:function(n){return 0 in arguments?this.each(function(t){var i=e(this,n,t,this.textContent);this.textContent=null==i?"":""+i}):0 in this?this[0].textContent:null},attr:function(n,t){var r;return"string"!=typeof n||1 in arguments?this.each(function(r){if(1===this.nodeType)if(l(n))for(i in n)it(this,i,n[i]);else it(this,n,e(this,t,r,this.getAttribute(n)))}):this.length&&1===this[0].nodeType?!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:u},removeAttr:function(n){return this.each(function(){1===this.nodeType&&it(this,n)})},prop:function(n,t){return n=si[n]||n,1 in arguments?this.each(function(i){this[n]=e(this,t,i,this[n])}):this[0]&&this[0][n]},data:function(n,t){var i="data-"+n.replace(ri,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,t):this.attr(i);return null!==r?at(r):u},val:function(t){return 0 in arguments?this.each(function(n){this.value=e(this,t,n,this.value)}):this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(i){var r=n(this),u=e(this,t,i,r.offset()),f=r.offsetParent().offset(),o={top:u.top-f.top,left:u.left-f.left};"static"==r.css("position")&&(o.position="relative");r.css(o)});if(!this.length)return null;var i=this[0].getBoundingClientRect();return{left:i.left+window.pageXOffset,top:i.top+window.pageYOffset,width:Math.round(i.width),height:Math.round(i.height)}},css:function(t,r){var u,e,o,f;if(arguments.length<2){if(u=this[0],e=getComputedStyle(u,""),!u)return;if("string"==typeof t)return u.style[d(t)]||e.getPropertyValue(t);if(a(t))return o={},n.each(t,function(n,t){o[t]=u.style[d(t)]||e.getPropertyValue(t)}),o}if(f="","string"==v(t))r||0===r?f=p(t)+":"+ht(t,r):this.each(function(){this.style.removeProperty(p(t))});else for(i in t)t[i]||0===t[i]?f+=p(i)+":"+ht(i,t[i])+";":this.each(function(){this.style.removeProperty(p(i))});return this.each(function(){this.style.cssText+=";"+f})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(n){return n?f.some.call(this,function(n){return this.test(c(n))},st(n)):!1},addClass:function(t){return t?this.each(function(i){if("className"in this){o=[];var r=c(this),u=e(this,t,i,r);u.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||o.push(t)},this);o.length&&c(this,r+(r?" ":"")+o.join(" "))}}):this},removeClass:function(n){return this.each(function(t){if("className"in this){if(n===u)return c(this,"");o=c(this);e(this,n,t,o).split(/\s+/g).forEach(function(n){o=o.replace(st(n)," ")});c(this,o.trim())}})},toggleClass:function(t,i){return t?this.each(function(r){var f=n(this),o=e(this,t,r,c(this));o.split(/\s+/g).forEach(function(n){(i===u?!f.hasClass(n):i)?f.addClass(n):f.removeClass(n)})}):this},scrollTop:function(n){if(this.length){var t="scrollTop"in this[0];return n===u?t?this[0].scrollTop:this[0].pageYOffset:this.each(t?function(){this.scrollTop=n}:function(){this.scrollTo(this.scrollX,n)})}},scrollLeft:function(n){if(this.length){var t="scrollLeft"in this[0];return n===u?t?this[0].scrollLeft:this[0].pageXOffset:this.each(t?function(){this.scrollLeft=n}:function(){this.scrollTo(n,this.scrollY)})}},position:function(){if(this.length){var u=this[0],t=this.offsetParent(),i=this.offset(),r=yt.test(t[0].nodeName)?{top:0,left:0}:t.offset();return i.top-=parseFloat(n(u).css("margin-top"))||0,i.left-=parseFloat(n(u).css("margin-left"))||0,r.top+=parseFloat(n(t[0]).css("border-top-width"))||0,r.left+=parseFloat(n(t[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||r.body;t&&!yt.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(t){var i=t.replace(/./,function(n){return n[0].toUpperCase()});n.fn[t]=function(r){var o,f=this[0];return r===u?nt(f)?f["inner"+i]:b(f)?f.documentElement["scroll"+i]:(o=this.offset())&&o[t]:this.each(function(i){f=n(this);f.css(t,e(this,r,i,f[t]()))})}}),["after","prepend","before","append"].forEach(function(i,u){var f=u%2;n.fn[i]=function(){var e,i,o=n.map(arguments,function(n){return e=v(n),"object"==e||"array"==e||null==n?n:t.fragment(n)}),s=this.length>1;return o.length<1?this:this.each(function(t,e){i=f?e:e.parentNode;e=0==u?e.nextSibling:1==u?e.firstChild:2==u?e:null;var h=n.contains(r.documentElement,i);o.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!i)return n(t).remove();i.insertBefore(t,e);h&&vt(t,function(n){null==n.nodeName||"SCRIPT"!==n.nodeName.toUpperCase()||n.type&&"text/javascript"!==n.type||n.src||window.eval.call(window,n.innerHTML)})})})};n.fn[f?i+"To":"insert"+(u?"Before":"After")]=function(t){return n(t)[i](this),this}}),t.Z.prototype=n.fn,t.uniq=g,t.deserializeValue=at,n.zepto=t,n}(),pfx;window.Zepto=Zepto;void 0===window.$&&(window.$=Zepto),function(n){function i(n){return n._zid||(n._zid=tt++)}function l(n,t,r,u){if(t=a(t),t.ns)var f=nt(t.ns);return(o[i(n)]||[]).filter(function(n){return!(!n||t.e&&n.e!=t.e||t.ns&&!f.test(n.ns)||r&&i(n.fn)!==i(r)||u&&n.sel!=u)})}function a(n){var t=(""+n).split(".");return{e:t[0],ns:t.slice(1).sort().join(" ")}}function nt(n){return new RegExp("(?:^| )"+n.replace(" "," .* ?")+"(?: |$)")}function v(n,t){return n.del&&!b&&n.e in k||!!t}function y(n){return d[n]||b&&k[n]||n}function p(t,u,e,s,h,c,l){var p=i(t),w=o[p]||(o[p]=[]);u.split(/\s/).forEach(function(i){var u,o;if("ready"==i)return n(document).ready(e);u=a(i);u.fn=e;u.sel=h;u.e in d&&(e=function(t){var i=t.relatedTarget;if(!i||i!==this&&!n.contains(this,i))return u.fn.apply(this,arguments)});u.del=c;o=c||e;u.proxy=function(n){if(n=f(n),!n.isImmediatePropagationStopped()){n.data=s;var i=o.apply(t,n._args==r?[n]:[n].concat(n._args));return i===!1&&(n.preventDefault(),n.stopPropagation()),i}};u.i=w.length;w.push(u);"addEventListener"in t&&t.addEventListener(y(u.e),u.proxy,v(u,l))})}function s(n,t,r,u,f){var e=i(n);(t||"").split(/\s/).forEach(function(t){l(n,t,r,u).forEach(function(t){delete o[e][t.i];"removeEventListener"in n&&n.removeEventListener(y(t.e),t.proxy,v(t,f))})})}function f(t,i){return(i||!t.isDefaultPrevented)&&(i||(i=t),n.each(rt,function(n,r){var u=i[n];t[n]=function(){return this[r]=g,u&&u.apply(i,arguments)};t[r]=c}),(i.defaultPrevented!==r?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(t.isDefaultPrevented=g)),t}function w(n){var t,i={originalEvent:n};for(t in n)it.test(t)||n[t]===r||(i[t]=n[t]);return f(i,n)}var r,tt=1,h=Array.prototype.slice,e=n.isFunction,t=function(n){return"string"==typeof n},o={},u={},b="onfocusin"in window,k={focus:"focusin",blur:"focusout"},d={mouseenter:"mouseover",mouseleave:"mouseout"};u.click=u.mousedown=u.mouseup=u.mousemove="MouseEvents";n.event={add:p,remove:s};n.proxy=function(r,u){var f=2 in arguments&&h.call(arguments,2),o;if(e(r))return o=function(){return r.apply(u,f?f.concat(h.call(arguments)):arguments)},o._zid=i(r),o;if(t(u))return f?(f.unshift(r[u],r),n.proxy.apply(null,f)):n.proxy(r[u],r);throw new TypeError("expected function");};n.fn.bind=function(n,t,i){return this.on(n,t,i)};n.fn.unbind=function(n,t){return this.off(n,t)};n.fn.one=function(n,t,i,r){return this.on(n,t,i,r,1)};var g=function(){return!0},c=function(){return!1},it=/^([A-Z]|returnValue$|layer[XY]$)/,rt={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};n.fn.delegate=function(n,t,i){return this.on(t,n,i)};n.fn.undelegate=function(n,t,i){return this.off(t,n,i)};n.fn.live=function(t,i){return n(document.body).delegate(this.selector,t,i),this};n.fn.die=function(t,i){return n(document.body).undelegate(this.selector,t,i),this};n.fn.on=function(i,u,f,o,l){var a,y,v=this;return i&&!t(i)?(n.each(i,function(n,t){v.on(n,u,f,t,l)}),v):(t(u)||e(o)||o===!1||(o=f,f=u,u=r),(e(f)||f===!1)&&(o=f,f=r),o===!1&&(o=c),v.each(function(t,r){l&&(a=function(n){return s(r,n.type,o),o.apply(this,arguments)});u&&(y=function(t){var f,i=n(t.target).closest(u,r).get(0);if(i&&i!==r)return(f=n.extend(w(t),{currentTarget:i,liveFired:r}),(a||o).apply(i,[f].concat(h.call(arguments,1))))});p(r,i,o,f,u,y||a)}))};n.fn.off=function(i,u,f){var o=this;return i&&!t(i)?(n.each(i,function(n,t){o.off(n,u,t)}),o):(t(u)||e(f)||f===!1||(f=u,u=r),f===!1&&(f=c),o.each(function(){s(this,i,f,u)}))};n.fn.trigger=function(i,r){return i=t(i)||n.isPlainObject(i)?n.Event(i):f(i),i._args=r,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(i):n(this).triggerHandler(i,r)})};n.fn.triggerHandler=function(i,r){var u,f;return this.each(function(e,o){u=w(t(i)?n.Event(i):i);u._args=r;u.target=o;n.each(l(o,i.type||i),function(n,t){return f=t.proxy(u),u.isImmediatePropagationStopped()?!1:void 0})}),f};"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(t){n.fn[t]=function(n){return n?this.bind(t,n):this.trigger(t)}});["focus","blur"].forEach(function(t){n.fn[t]=function(n){return n?this.bind(t,n):this.each(function(){try{this[t]()}catch(n){}}),this}});n.Event=function(n,i){var e,o,r;if(t(n)||(i=n,n=i.type),e=document.createEvent(u[n]||"Events"),o=!0,i)for(r in i)"bubbles"==r?o=!!i[r]:e[r]=i[r];return e.initEvent(n,o,!0),f(e)}}(Zepto),function(n){function w(t,i,r){var u=n.Event(i);return n(t).trigger(u,r),!u.isDefaultPrevented()}function i(n,t,i,r){if(n.global)return w(t||s,i,r)}function b(t){t.global&&0==n.active++&&i(t,null,"ajaxStart")}function k(t){t.global&&!--n.active&&i(t,null,"ajaxStop")}function c(n,t){var r=t.context;return t.beforeSend.call(r,n,t)===!1||i(t,r,"ajaxBeforeSend",[n,t])===!1?!1:void i(t,r,"ajaxSend",[n,t])}function l(n,t,r,u){var f=r.context,e="success";r.success.call(f,n,e,t);u&&u.resolveWith(f,[n,e,t]);i(r,f,"ajaxSuccess",[t,r,n]);a(e,t,r)}function u(n,t,r,u,f){var e=u.context;u.error.call(e,r,t,n);f&&f.rejectWith(e,[r,t,n]);i(u,e,"ajaxError",[r,u,n||t]);a(t,r,u)}function a(n,t,r){var u=r.context;r.complete.call(u,t,n);i(r,u,"ajaxComplete",[t,r]);k(r)}function r(){}function d(n){return n&&(n=n.split(";",2)[0]),n&&(n==p?"html":n==y?"json":it.test(n)?"script":rt.test(n)&&"xml")||"text"}function o(n,t){return""==t?n:(n+"&"+t).replace(/[&?]{1,2}/,"?")}function g(t){t.processData&&t.data&&"string"!=n.type(t.data)&&(t.data=n.param(t.data,t.traditional));!t.data||t.type&&"GET"!=t.type.toUpperCase()||(t.url=o(t.url,t.data),t.data=void 0)}function f(t,i,r,u){return n.isFunction(i)&&(u=r,r=i,i=void 0),n.isFunction(r)||(u=r,r=void 0),{url:t,data:i,success:r,dataType:u}}function v(t,i,r,u){var f,e=n.isArray(i),o=n.isPlainObject(i);n.each(i,function(i,s){f=n.type(s);u&&(i=r?u:u+"["+(o||"object"==f||"array"==f?i:"")+"]");!u&&e?t.add(s.name,s.value):"array"==f||!r&&"object"==f?v(t,s,r,i):t.add(i,s)})}var e,t,nt=0,s=window.document,tt=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,it=/^(?:text|application)\/javascript/i,rt=/^(?:text|application)\/xml/i,y="application/json",p="text/html",ut=/^\s*$/,h;n.active=0;n.ajaxJSONP=function(t,i){if(!("type"in t))return n.ajax(t);var r,y,a=t.jsonpCallback,o=(n.isFunction(a)?a():a)||"jsonp"+ ++nt,e=s.createElement("script"),h=window[o],v=function(t){n(e).triggerHandler("error",t||"abort")},f={abort:v};return i&&i.promise(f),n(e).on("load error",function(s,c){clearTimeout(y);n(e).off().remove();"error"!=s.type&&r?l(r[0],f,t,i):u(null,c||"error",f,t,i);window[o]=h;r&&n.isFunction(h)&&h(r[0]);h=r=void 0}),c(f,t)===!1?(v("abort"),f):(window[o]=function(){r=arguments},e.src=t.url.replace(/\?(.+)=\?/,"?$1="+o),s.head.appendChild(e),t.timeout>0&&(y=setTimeout(function(){v("timeout")},t.timeout)),f)};n.ajaxSettings={type:"GET",beforeSend:r,success:r,error:r,complete:r,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:y,xml:"application/xml, text/xml",html:p,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0};n.ajax=function(i){var f=n.extend({},i||{}),a=n.Deferred&&n.Deferred(),h,p,nt;for(e in n.ajaxSettings)void 0===f[e]&&(f[e]=n.ajaxSettings[e]);if(b(f),f.crossDomain||(f.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(f.url)&&RegExp.$2!=window.location.host),f.url||(f.url=window.location.toString()),g(f),h=f.dataType,p=/\?.+=\?/.test(f.url),p&&(h="jsonp"),f.cache!==!1&&(i&&i.cache===!0||"script"!=h&&"jsonp"!=h)||(f.url=o(f.url,"_="+Date.now())),"jsonp"==h)return p||(f.url=o(f.url,f.jsonp?f.jsonp+"=?":f.jsonp===!1?"":"callback=?")),n.ajaxJSONP(f,a);var k,v=f.accepts[h],w={},y=function(n,t){w[n.toLowerCase()]=[n,t]},tt=/^([\w-]+:)\/\//.test(f.url)?RegExp.$1:window.location.protocol,s=f.xhr(),it=s.setRequestHeader;if(a&&a.promise(s),f.crossDomain||y("X-Requested-With","XMLHttpRequest"),y("Accept",v||"*/*"),(v=f.mimeType||v)&&(v.indexOf(",")>-1&&(v=v.split(",",2)[0]),s.overrideMimeType&&s.overrideMimeType(v)),(f.contentType||f.contentType!==!1&&f.data&&"GET"!=f.type.toUpperCase())&&y("Content-Type",f.contentType||"application/x-www-form-urlencoded"),f.headers)for(t in f.headers)y(t,f.headers[t]);if(s.setRequestHeader=y,s.onreadystatechange=function(){if(4==s.readyState){s.onreadystatechange=r;clearTimeout(k);var t,i=!1;if(s.status>=200&&s.status<300||304==s.status||0==s.status&&"file:"==tt){h=h||d(f.mimeType||s.getResponseHeader("content-type"));t=s.responseText;try{"script"==h?eval(t):"xml"==h?t=s.responseXML:"json"==h&&(t=ut.test(t)?null:n.parseJSON(t))}catch(e){i=e}i?u(i,"parsererror",s,f,a):l(t,s,f,a)}else u(s.statusText||null,s.status?"error":"abort",s,f,a)}},c(s,f)===!1)return s.abort(),u(null,"abort",s,f,a),s;if(f.xhrFields)for(t in f.xhrFields)s[t]=f.xhrFields[t];nt="async"in f?f.async:!0;s.open(f.type,f.url,nt,f.username,f.password);for(t in w)it.apply(s,w[t]);return f.timeout>0&&(k=setTimeout(function(){s.onreadystatechange=r;s.abort();u(null,"timeout",s,f,a)},f.timeout)),s.send(f.data?f.data:null),s};n.get=function(){return n.ajax(f.apply(null,arguments))};n.post=function(){var t=f.apply(null,arguments);return t.type="POST",n.ajax(t)};n.getJSON=function(){var t=f.apply(null,arguments);return t.dataType="json",n.ajax(t)};n.fn.load=function(t,i,r){if(!this.length)return this;var e,s=this,o=t.split(/\s/),u=f(t,i,r),h=u.success;return o.length>1&&(u.url=o[0],e=o[1]),u.success=function(t){s.html(e?n("<div>").html(t.replace(tt,"")).find(e):t);h&&h.apply(s,arguments)},n.ajax(u),this};h=encodeURIComponent;n.param=function(n,t){var i=[];return i.add=function(n,t){this.push(h(n)+"="+h(t))},v(i,n,t),i.join("&").replace(/%20/g,"+")}}(Zepto),function(n){n.fn.serializeArray=function(){var i,t,r=[];return n([].slice.call(this.get(0).elements)).each(function(){i=n(this);t=i.attr("type");this.name&&"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=t&&"reset"!=t&&"button"!=t&&("radio"!=t&&"checkbox"!=t||this.checked)&&r.push({name:i.attr("name"),value:i.val()})}),r};n.fn.serialize=function(){var n=[];return this.serializeArray().forEach(function(t){n.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.value))}),n.join("&")};n.fn.submit=function(t){if(t)this.bind("submit",t);else if(this.length){var i=n.Event("submit");this.eq(0).trigger(i);i.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(n){"__proto__"in{}||n.extend(n.zepto,{Z:function(t,i){return t=t||[],n.extend(t,n.fn),t.selector=i||"",t.__Z=!0,t},isZ:function(t){return"array"===n.type(t)&&"__Z"in t}});try{getComputedStyle(void 0)}catch(i){var t=getComputedStyle;window.getComputedStyle=function(n){try{return t(n)}catch(i){return null}}}}(Zepto),function(n,t){function w(n){return n.replace(/([a-z])([A-Z])/,"$1-$2").toLowerCase()}function o(n){return u?u+n:n.toLowerCase()}var u,f,s,h,c,l,a,v,y,p,i="",b=window.document,e=b.createElement("div"),k=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,r={};n.each({Webkit:"webkit",Moz:"",O:"o"},function(n,r){if(e.style[n+"TransitionProperty"]!==t)return(i="-"+n.toLowerCase()+"-",u=r,!1)});f=i+"transform";r[s=i+"transition-property"]=r[h=i+"transition-duration"]=r[l=i+"transition-delay"]=r[c=i+"transition-timing-function"]=r[a=i+"animation-name"]=r[v=i+"animation-duration"]=r[p=i+"animation-delay"]=r[y=i+"animation-timing-function"]="";n.fx={off:u===t&&e.style.transitionProperty===t,speeds:{_default:400,fast:200,slow:600},cssPrefix:i,transitionEnd:o("TransitionEnd"),animationEnd:o("AnimationEnd")};n.fn.animate=function(i,r,u,f,e){return n.isFunction(r)&&(f=r,u=t,r=t),n.isFunction(u)&&(f=u,u=t),n.isPlainObject(r)&&(u=r.easing,f=r.complete,e=r.delay,r=r.duration),r&&(r=("number"==typeof r?r:n.fx.speeds[r]||n.fx.speeds._default)/1e3),e&&(e=parseFloat(e)/1e3),this.anim(i,r,u,f,e)};n.fn.anim=function(i,u,e,o,b){var g,tt,nt,d={},rt="",ut=this,it=n.fx.transitionEnd,ft=!1;if(u===t&&(u=n.fx.speeds._default/1e3),b===t&&(b=0),n.fx.off&&(u=0),"string"==typeof i)d[a]=i,d[v]=u+"s",d[p]=b+"s",d[y]=e||"linear",it=n.fx.animationEnd;else{tt=[];for(g in i)k.test(g)?rt+=g+"("+i[g]+") ":(d[g]=i[g],tt.push(w(g)));rt&&(d[f]=rt,tt.push(f));u>0&&"object"==typeof i&&(d[s]=tt.join(", "),d[h]=u+"s",d[l]=b+"s",d[c]=e||"linear")}return nt=function(t){if("undefined"!=typeof t){if(t.target!==t.currentTarget)return;n(t.target).unbind(it,nt)}else n(this).unbind(it,nt);ft=!0;n(this).css(r);o&&o.call(this)},u>0&&(this.bind(it,nt),setTimeout(function(){ft||nt.call(ut)},1e3*u+25)),this.size()&&this.get(0).clientLeft,this.css(d),0>=u&&setTimeout(function(){ut.each(function(){nt.call(this)})},0),this};e=null}(Zepto),function(n,t){function i(i,r,u,f,e){"function"!=typeof r||e||(e=r,r=t);var o={opacity:u};return f&&(o.scale=f,i.css(n.fx.cssPrefix+"transform-origin","0 0")),i.animate(o,r,null,e)}function r(t,r,u,e){return i(t,r,0,u,function(){f.call(n(this));e&&e.call(this)})}var e=window.document,u=(e.documentElement,n.fn.show),f=n.fn.hide,o=n.fn.toggle;n.fn.show=function(n,r){return u.call(this),n===t?n=0:this.css("opacity",0),i(this,n,1,"1,1",r)};n.fn.hide=function(n,i){return n===t?f.call(this):r(this,n,"0,0",i)};n.fn.toggle=function(i,r){return i===t||"boolean"==typeof i?o.call(this,i):this.each(function(){var t=n(this);t["none"==t.css("display")?"show":"hide"](i,r)})};n.fn.fadeTo=function(n,t,r){return i(this,n,t,null,r)};n.fn.fadeIn=function(n,t){var i=this.css("opacity");return i>0?this.css("opacity",0):i=1,u.call(this).fadeTo(n,i,t)};n.fn.fadeOut=function(n,t){return r(this,n,null,t)};n.fn.fadeToggle=function(t,i){return this.each(function(){var r=n(this);r[0==r.css("opacity")||"none"==r.css("display")?"fadeIn":"fadeOut"](t,i)})}}(Zepto),function(n){function t(n){var t=this.os={},i=this.browser={},y=n.match(/Web[kK]it[\/]{0,1}([\d.]+)/),u=n.match(/(Android);?[\s\/]+([\d.]+)?/),p=!!n.match(/\(Macintosh\; Intel /),f=n.match(/(iPad).*OS\s([\d_]+)/),e=n.match(/(iPod)(.*OS\s([\d_]+))?/),c=!f&&n.match(/(iPhone\sOS)\s([\d_]+)/),o=n.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),w=n.match(/Windows Phone ([\d.]+)/),tt=o&&n.match(/TouchPad/),b=n.match(/Kindle\/([\d.]+)/),l=n.match(/Silk\/([\d._]+)/),a=n.match(/(BlackBerry).*Version\/([\d.]+)/),v=n.match(/(BB10).*Version\/([\d.]+)/),k=n.match(/(RIM\sTablet\sOS)\s([\d.]+)/),d=n.match(/PlayBook/),r=n.match(/Chrome\/([\d.]+)/)||n.match(/CriOS\/([\d.]+)/),s=n.match(/Firefox\/([\d.]+)/),h=n.match(/MSIE\s([\d.]+)/)||n.match(/Trident\/[\d](?=[^\?]+).*rv:([0-9.].)/),g=!r&&n.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/),nt=g||n.match(/Version\/([\d.]+)([^S](Safari)|[^M]*(Mobile)[^S]*(Safari))/);(i.webkit=!!y)&&(i.version=y[1]);u&&(t.android=!0,t.version=u[2]);c&&!e&&(t.ios=t.iphone=!0,t.version=c[2].replace(/_/g,"."));f&&(t.ios=t.ipad=!0,t.version=f[2].replace(/_/g,"."));e&&(t.ios=t.ipod=!0,t.version=e[3]?e[3].replace(/_/g,"."):null);w&&(t.wp=!0,t.version=w[1]);o&&(t.webos=!0,t.version=o[2]);tt&&(t.touchpad=!0);a&&(t.blackberry=!0,t.version=a[2]);v&&(t.bb10=!0,t.version=v[2]);k&&(t.rimtabletos=!0,t.version=k[2]);d&&(i.playbook=!0);b&&(t.kindle=!0,t.version=b[1]);l&&(i.silk=!0,i.version=l[1]);!l&&t.android&&n.match(/Kindle Fire/)&&(i.silk=!0);r&&(i.chrome=!0,i.version=r[1]);s&&(i.firefox=!0,i.version=s[1]);h&&(i.ie=!0,i.version=h[1]);nt&&(p||t.ios)&&(i.safari=!0,p&&(i.version=nt[1]));g&&(i.webview=!0);t.tablet=!!(f||d||u&&!n.match(/Mobile/)||s&&n.match(/Tablet/)||h&&!n.match(/Phone/)&&n.match(/Touch/));t.phone=!(t.tablet||t.ipod||!(u||c||o||a||v||r&&n.match(/Android/)||r&&n.match(/CriOS\/([\d.]+)/)||s&&n.match(/Mobile/)||h&&n.match(/Touch/)))}t.call(n,navigator.userAgent);n.__detect=t}(Zepto),function(n){function l(n,t,i,r){return Math.abs(n-t)>=Math.abs(i-r)?n-t>0?"Left":"Right":i-r>0?"Up":"Down"}function a(){i=null;t.last&&(t.el.trigger("longTap"),t={})}function c(){i&&clearTimeout(i);i=null}function o(){r&&clearTimeout(r);u&&clearTimeout(u);f&&clearTimeout(f);i&&clearTimeout(i);r=u=f=i=null;t={}}function s(n){return("touch"==n.pointerType||n.pointerType==n.MSPOINTER_TYPE_TOUCH)&&n.isPrimary}function h(n,t){return n.type=="pointer"+t||n.type.toLowerCase()=="mspointer"+t}var r,u,f,i,e,t={},v=750;n(document).ready(function(){var w,b,y,p,k=0,d=0;"MSGesture"in window&&(e=new MSGesture,e.target=document.body);n(document).bind("MSGestureEnd",function(n){var i=n.velocityX>1?"Right":n.velocityX<-1?"Left":n.velocityY>1?"Down":n.velocityY<-1?"Up":null;i&&(t.el.trigger("swipe"),t.el.trigger("swipe"+i))}).on("touchstart MSPointerDown pointerdown",function(u){(p=h(u,"down"))&&!s(u)||(y=p?u:u.touches[0],u.touches&&1===u.touches.length&&t.x2&&(t.x2=void 0,t.y2=void 0),w=Date.now(),b=w-(t.last||w),t.el=n("tagName"in y.target?y.target:y.target.parentNode),r&&clearTimeout(r),t.x1=y.pageX,t.y1=y.pageY,b>0&&250>=b&&(t.isDoubleTap=!0),t.last=w,i=setTimeout(a,v),e&&p&&e.addPointer(u.pointerId))}).on("touchmove MSPointerMove pointermove",function(n){(p=h(n,"move"))&&!s(n)||(y=p?n:n.touches[0],c(),t.x2=y.pageX,t.y2=y.pageY,k+=Math.abs(t.x1-t.x2),d+=Math.abs(t.y1-t.y2))}).on("touchend MSPointerUp pointerup",function(i){(p=h(i,"up"))&&!s(i)||(c(),t.x2&&Math.abs(t.x1-t.x2)>30||t.y2&&Math.abs(t.y1-t.y2)>30?f=setTimeout(function(){t.el.trigger("swipe");t.el.trigger("swipe"+l(t.x1,t.x2,t.y1,t.y2));t={}},0):"last"in t&&(30>k&&30>d?u=setTimeout(function(){var i=n.Event("tap");i.cancelTouch=o;t.el.trigger(i);t.isDoubleTap?(t.el&&t.el.trigger("doubleTap"),t={}):r=setTimeout(function(){r=null;t.el&&t.el.trigger("singleTap");t={}},250)},0):t={}),k=d=0)}).on("touchcancel MSPointerCancel pointercancel",o);n(window).on("scroll",o)});["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(t){n.fn[t]=function(n){return this.on(t,n)}})}(Zepto),function(n){function t(n,t){var i=document.createEvent(t);"dispatchEvent"in n&&n.dispatchEvent(i)}n.extend(n.fn,{click_t:function(){return this.each(t(this,"click_t"))},scroll_t:function(){return this.each(t(this,"scroll_t"))}});["click_t","scroll_t"].forEach(function(t){n.fn[t]=function(i){return i?"click_t"==t?n.os.phone||n.os.tablet?n(this).tap(i):n(this).on("click",i):"scroll_t"==t?n.os.phone||n.os.tablet?n(this).on("touchmove MSPointerMove pointermove",i):n(this).on("scroll",i):this.bind(t,i):this.each(function(){try{this[t]()}catch(n){}}),this}})}(Zepto);pfx=["webkit","moz","MS","o",""];!function(n,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t:n.echo=t(n)}(this,function(n){"use strict";var r,e,o,u,t={},f=function(){},s=function(n,t){var i=n.getBoundingClientRect();return i.right>=t.l&&i.bottom>=t.t&&i.left<=t.r&&i.top<=t.b},i=function(){clearTimeout(e);e=setTimeout(t.render,o)};return t.init=function(e){e=e||{};var h=e.offset||0,c=e.offsetVertical||h,l=e.offsetHorizontal||h,s=function(n,t){return parseInt(n||t,10)};r={t:s(e.offsetTop,c),b:s(e.offsetBottom,c),l:s(e.offsetLeft,l),r:s(e.offsetRight,l)};o=s(e.throttle,250);u=!!e.unload;f=e.callback||f;t.render();document.addEventListener?(n.addEventListener("scroll",i,!1),n.addEventListener("load",i,!1)):(n.attachEvent("onscroll",i),n.attachEvent("onload",i))},t.render=function(){for(var o,i,h=document.querySelectorAll("img[data-echo]"),c=h.length,l={l:0-r.l,t:0-r.t,b:(n.innerHeight||document.documentElement.clientHeight)+r.b,r:(n.innerWidth||document.documentElement.clientWidth)+r.r},e=0;c>e;e++)i=h[e],s(i,l)?(u&&i.setAttribute("data-echo-placeholder",i.src),i.src=i.getAttribute("data-echo"),u||i.removeAttribute("data-echo"),f(i,"load")):u&&(o=i.getAttribute("data-echo-placeholder"))&&(i.src=o,i.removeAttribute("data-echo-placeholder"),f(i,"unload"));c||t.detach()},t.detach=function(){document.removeEventListener?n.removeEventListener("scroll",i):n.detachEvent("onscroll",i);clearTimeout(e)},t});!function(n,t){function i(n,i){function nt(){delete o[y];r=null}function tt(){var n=0,t;for(t in r.tables)r.tables.hasOwnProperty(t)&&n++;return n}function it(n){return r.tables[n].fields}function p(n){return r.tables[n]?!0:!1}function f(n){p(n)||u("The table '"+n+"' does not exist")}function rt(n,t){var i=!1,u=r.tables[n].fields,f;for(f in u)if(u[f]==t){i=!0;break}return i}function ut(n,t){r.tables[n]={fields:t,auto_increment:1};r.data[n]={}}function ft(n){delete r.tables[n];delete r.data[n]}function et(n){r.tables[n].auto_increment=1;r.data[n]={}}function w(n,t,i){var u,f;if(r.tables[n].fields=r.tables[n].fields.concat(t),"undefined"!=typeof i)for(u in r.data[n])if(r.data[n].hasOwnProperty(u))for(f in t)r.data[n][u][t[f]]="object"==typeof i?i[t[f]]:i}function ot(n){var t=0,i;for(i in r.data[n])r.data[n].hasOwnProperty(i)&&t++;return t}function a(n,t){return t.ID=r.tables[n].auto_increment,r.data[n][r.tables[n].auto_increment]=t,r.tables[n].auto_increment++,t.ID}function st(n,t,i,u,f){for(var s=null,o=[],h=null,e=0;e<t.length;e++)s=t[e],h=r.data[n][s],o.push(v(h));if(f&&f instanceof Array)for(e=0;e<f.length;e++)o.sort(ht(f[e][0],f[e].length>1?f[e][1]:null));return i=i&&"number"==typeof i?i:null,u=u&&"number"==typeof u?u:null,i&&u?o=o.slice(i,i+u):i?o=o.slice(i):u&&(o=o.slice(i,u)),o}function ht(n,t){return function(i,r){return"DESC"===t?i[n]<r[n]:i[n]>r[n]}}function h(n,t){var o=[],u=!1,e=null,f,i;for(f in r.data[n])if(r.data[n].hasOwnProperty(f)){e=r.data[n][f];u=!0;for(i in t)if(t.hasOwnProperty(i))if("string"==typeof t[i]){if(e[i].toString().toLowerCase()!=t[i].toString().toLowerCase()){u=!1;break}}else if(e[i]!=t[i]){u=!1;break}u&&o.push(f)}return o}function c(n,t){var u=[],f=null,i;for(i in r.data[n])r.data[n].hasOwnProperty(i)&&(f=r.data[n][i],1==t(v(f))&&u.push(i));return u}function l(n){var i=[],t;for(t in r.data[n])r.data[n].hasOwnProperty(t)&&i.push(t);return i}function ct(n,t){for(var i=0;i<t.length;i++)r.data[n].hasOwnProperty(t[i])&&delete r.data[n][t[i]];return t.length}function b(n,t,i){for(var u,h,e,f="",c=0,o=0;o<t.length;o++)if(f=t[o],u=i(v(r.data[n][f])),u){delete u.ID;h=r.data[n][f];for(e in u)u.hasOwnProperty(e)&&(h[e]=u[e]);r.data[n][f]=s(n,h);c++}return c}function k(){try{return o.setItem(y,JSON.stringify(r)),!0}catch(n){return!1}}function lt(){return JSON.stringify(r)}function u(n){throw new Error(n);}function v(n){var i={},t;for(t in n)n.hasOwnProperty(t)&&(i[t]=n[t]);return i}function e(n){return n.toString().match(/[^a-z_0-9]/gi)?!1:!0}function s(n,i){for(var u="",e={},f=0;f<r.tables[n].fields.length;f++)u=r.tables[n].fields[f],i[u]!==t&&(e[u]=i[u]);return e}function d(n,i){for(var u="",e={},f=0;f<r.tables[n].fields.length;f++)u=r.tables[n].fields[f],e[u]=null===i[u]||i[u]===t?null:i[u];return e}var y="db_"+n,g=!1,r=null,o;try{o=i==sessionStorage?sessionStorage:localStorage}catch(at){o=i}return r=o[y],r&&(r=JSON.parse(r))&&r.tables&&r.data||(e(n)?(r={tables:{},data:{}},k(),g=!0):u("The name '"+n+"' contains invalid characters")),{commit:function(){return k()},isNew:function(){return g},drop:function(){nt()},serialize:function(){return lt()},tableExists:function(n){return p(n)},tableFields:function(n){return it(n)},tableCount:function(){return tt()},columnExists:function(n,t){return rt(n,t)},createTable:function(n,t){var s=!1,f,r,i,o;if(e(n))if(this.tableExists(n))u("The table name '"+n+"' already exists.");else{for(f=!0,i=0;i<t.length;i++)if(!e(t[i])){f=!1;break}if(f){for(r={},i=0;i<t.length;i++)r[t[i]]=!0;delete r.ID;t=["ID"];for(o in r)r.hasOwnProperty(o)&&t.push(o);ut(n,t);s=!0}else u("One or more field names in the table definition contains invalid characters")}else u("The database name '"+n+"' contains invalid characters.");return s},createTableWithData:function(n,t){var r,i;if(("object"!=typeof t||!t.length||t.length<1)&&u("Data supplied isn't in object form. Example: [{k:v,k:v},{k:v,k:v} ..]"),r=Object.keys(t[0]),this.createTable(n,r)){for(this.commit(),i=0;i<t.length;i++)a(n,t[i])||u("Failed to insert record: ["+JSON.stringify(t[i])+"]");this.commit()}return!0},dropTable:function(n){f(n);ft(n)},truncate:function(n){f(n);et(n)},alterTable:function(n,t,i){var o=!1,s,f,r,h,c;if(e(n))if("object"==typeof t){for(s=!0,r=0;r<t.length;r++)if(!e(t[r])){s=!1;break}if(s){for(f={},r=0;r<t.length;r++)f[t[r]]=!0;delete f.ID;t=[];for(h in f)f.hasOwnProperty(h)&&t.push(h);w(n,t,i);o=!0}else u("One or more field names in the table definition contains invalid characters")}else"string"==typeof t&&(e(t)?(c=[],c.push(t),w(n,c,i),o=!0):u("One or more field names in the table definition contains invalid characters"));else u("The database name '"+n+"' contains invalid characters");return o},rowCount:function(n){return f(n),ot(n)},insert:function(n,t){return f(n),a(n,d(n,t))},insertOrUpdate:function(n,t,i){var r,u,e;if(f(n),r=[],t?"object"==typeof t?r=h(n,s(n,t)):"function"==typeof t&&(r=c(n,t)):r=l(n),0==r.length)return a(n,d(n,i));for(u=[],e=0;e<r.length;e++)b(n,r,function(n){return u.push(n.ID),i});return u},update:function(n,t,i){f(n);var r=[];return t?"object"==typeof t?r=h(n,s(n,t)):"function"==typeof t&&(r=c(n,t)):r=l(n),b(n,r,i)},query:function(n,t,i,r,u){f(n);var e=[];return t?"object"==typeof t?e=h(n,s(n,t),i,r):"function"==typeof t&&(e=c(n,t,i,r)):e=l(n,i,r),st(n,e,r,i,u)},queryAll:function(n,t){return this.query(n,t.hasOwnProperty("query")?t.query:null,t.hasOwnProperty("limit")?t.limit:null,t.hasOwnProperty("start")?t.start:null,t.hasOwnProperty("sort")?t.sort:null)},deleteRows:function(n,t){f(n);var i=[];return t?"object"==typeof t?i=h(n,s(n,t)):"function"==typeof t&&(i=c(n,t)):i=l(n),ct(n,i)}}}"function"==typeof define&&define.amd?define(function(){return i}):n.localStorageDB=i}(window);var cookieLang="m_language",cookieConutry="m_conutry",cookieCurrency="m_currency",defaultLang="en",pref,kReturnUrl="m_return_url";$(document).ready(function(){pref=new Pref;pref.finish()})