").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("
").addClass("ui-tooltip-content").appendTo(s),s.appendTo(this.document[0].body),this.tooltips[i]=t,s},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,a){var s=e.Event("blur");s.target=s.currentTarget=a[0],t.close(s,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))})}})})(jQuery);(function(e,t){var i="ui-effects-";e.effects={effect:{}},function(e,t){function i(e,t,i){var a=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=a.floor?~~e:parseFloat(e),isNaN(e)?t.def:a.mod?(e+a.mod)%a.mod:0>e?0:e>a.max?a.max:e)}function a(i){var a=l(),s=a._rgba=[];return i=i.toLowerCase(),m(h,function(e,r){var n,o=r.re.exec(i),h=o&&r.parse(o),l=r.space||"rgba";return h?(n=a[l](h),a[u[l].cache]=n[u[l].cache],s=a._rgba=n._rgba,!1):t}),s.length?("0,0,0,0"===s.join()&&e.extend(s,r.transparent),a):r[i]}function s(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var r,n="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",o=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,a,s){return new e.Color.fn.parse(t,i,a,s)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("
")[0],m=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,m(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(s,n,o,h){if(s===t)return this._rgba=[null,null,null,null],this;(s.jquery||s.nodeType)&&(s=e(s).css(n),n=t);var d=this,c=e.type(s),p=this._rgba=[];return n!==t&&(s=[s,n,o,h],c="array"),"string"===c?this.parse(a(s)||r._default):"array"===c?(m(u.rgba.props,function(e,t){p[t.idx]=i(s[t.idx],t)}),this):"object"===c?(s instanceof l?m(u,function(e,t){s[t.cache]&&(d[t.cache]=s[t.cache].slice())}):m(u,function(t,a){var r=a.cache;m(a.props,function(e,t){if(!d[r]&&a.to){if("alpha"===e||null==s[e])return;d[r]=a.to(d._rgba)}d[r][t.idx]=i(s[e],t,!0)}),d[r]&&0>e.inArray(null,d[r].slice(0,3))&&(d[r][3]=1,a.from&&(d._rgba=a.from(d[r])))}),this):t},is:function(e){var i=l(e),a=!0,s=this;return m(u,function(e,r){var n,o=i[r.cache];return o&&(n=s[r.cache]||r.to&&r.to(s._rgba)||[],m(r.props,function(e,i){return null!=o[i.idx]?a=o[i.idx]===n[i.idx]:t})),a}),a},_space:function(){var e=[],t=this;return m(u,function(i,a){t[a.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var a=l(e),s=a._space(),r=u[s],n=0===this.alpha()?l("transparent"):this,o=n[r.cache]||r.to(n._rgba),h=o.slice();return a=a[r.cache],m(r.props,function(e,s){var r=s.idx,n=o[r],l=a[r],u=d[s.type]||{};null!==l&&(null===n?h[r]=l:(u.mod&&(l-n>u.mod/2?n+=u.mod:n-l>u.mod/2&&(n-=u.mod)),h[r]=i((l-n)*t+n,s)))}),this[s](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),a=i.pop(),s=l(t)._rgba;return l(e.map(i,function(e,t){return(1-a)*s[t]+a*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),a=i.pop();return t&&i.push(~~(255*a)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,a=e[0]/255,s=e[1]/255,r=e[2]/255,n=e[3],o=Math.max(a,s,r),h=Math.min(a,s,r),l=o-h,u=o+h,d=.5*u;return t=h===o?0:a===o?60*(s-r)/l+360:s===o?60*(r-a)/l+120:60*(a-s)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==n?1:n]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],a=e[2],r=e[3],n=.5>=a?a*(1+i):a+i-a*i,o=2*a-n;return[Math.round(255*s(o,n,t+1/3)),Math.round(255*s(o,n,t)),Math.round(255*s(o,n,t-1/3)),r]},m(u,function(a,s){var r=s.props,n=s.cache,h=s.to,u=s.from;l.fn[a]=function(a){if(h&&!this[n]&&(this[n]=h(this._rgba)),a===t)return this[n].slice();var s,o=e.type(a),d="array"===o||"object"===o?a:arguments,c=this[n].slice();return m(r,function(e,t){var a=d["object"===o?e:t.idx];null==a&&(a=c[t.idx]),c[t.idx]=i(a,t)}),u?(s=l(u(c)),s[n]=c,s):l(c)},m(r,function(t,i){l.fn[t]||(l.fn[t]=function(s){var r,n=e.type(s),h="alpha"===t?this._hsla?"hsla":"rgba":a,l=this[h](),u=l[i.idx];return"undefined"===n?u:("function"===n&&(s=s.call(this,u),n=e.type(s)),null==s&&i.empty?this:("string"===n&&(r=o.exec(s),r&&(s=u+parseFloat(r[2])*("+"===r[1]?1:-1))),l[i.idx]=s,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");m(i,function(t,i){e.cssHooks[i]={set:function(t,s){var r,n,o="";if("transparent"!==s&&("string"!==e.type(s)||(r=a(s)))){if(s=l(r||s),!c.rgba&&1!==s._rgba[3]){for(n="backgroundColor"===i?t.parentNode:t;(""===o||"transparent"===o)&&n&&n.style;)try{o=e.css(n,"backgroundColor"),n=n.parentNode}catch(h){}s=s.blend(o&&"transparent"!==o?o:"_default")}s=s.toRgbaString()}try{t.style[i]=s}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(n),e.cssHooks.borderColor={expand:function(e){var t={};return m(["Top","Right","Bottom","Left"],function(i,a){t["border"+a+"Color"]=e}),t}},r=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(t){var i,a,s=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,r={};if(s&&s.length&&s[0]&&s[s[0]])for(a=s.length;a--;)i=s[a],"string"==typeof s[i]&&(r[e.camelCase(i)]=s[i]);else for(i in s)"string"==typeof s[i]&&(r[i]=s[i]);return r}function a(t,i){var a,s,n={};for(a in i)s=i[a],t[a]!==s&&(r[a]||(e.fx.step[a]||!isNaN(parseFloat(s)))&&(n[a]=s));return n}var s=["add","remove","toggle"],r={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(t,r,n,o){var h=e.speed(r,n,o);return this.queue(function(){var r,n=e(this),o=n.attr("class")||"",l=h.children?n.find("*").addBack():n;l=l.map(function(){var t=e(this);return{el:t,start:i(this)}}),r=function(){e.each(s,function(e,i){t[i]&&n[i+"Class"](t[i])})},r(),l=l.map(function(){return this.end=i(this.el[0]),this.diff=a(this.start,this.end),this}),n.attr("class",o),l=l.map(function(){var t=this,i=e.Deferred(),a=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,a),i.promise()}),e.when.apply(e,l.get()).done(function(){r(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(n[0])})})},e.fn.extend({addClass:function(t){return function(i,a,s,r){return a?e.effects.animateClass.call(this,{add:i},a,s,r):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,a,s,r){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},a,s,r):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(i){return function(a,s,r,n,o){return"boolean"==typeof s||s===t?r?e.effects.animateClass.call(this,s?{add:a}:{remove:a},r,n,o):i.apply(this,arguments):e.effects.animateClass.call(this,{toggle:a},s,r,n)}}(e.fn.toggleClass),switchClass:function(t,i,a,s,r){return e.effects.animateClass.call(this,{add:i,remove:t},a,s,r)}})}(),function(){function a(t,i,a,s){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(s=i,a=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(s=a,a=i,i={}),e.isFunction(a)&&(s=a,a=null),i&&e.extend(t,i),a=a||i.duration,t.duration=e.fx.off?0:"number"==typeof a?a:a in e.fx.speeds?e.fx.speeds[a]:e.fx.speeds._default,t.complete=s||i.complete,t}function s(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.10.4",save:function(e,t){for(var a=0;t.length>a;a++)null!==t[a]&&e.data(i+t[a],e[0].style[t[a]])},restore:function(e,a){var s,r;for(r=0;a.length>r;r++)null!==a[r]&&(s=e.data(i+a[r]),s===t&&(s=""),e.css(a[r],s))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,a;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":a=0;break;case"center":a=.5;break;case"right":a=1;break;default:a=e[1]/t.width}return{x:a,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},a=e("
").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),s={width:t.width(),height:t.height()},r=document.activeElement;try{r.id}catch(n){r=document.body}return t.wrap(a),(t[0]===r||e.contains(t[0],r))&&e(r).focus(),a=t.parent(),"static"===t.css("position")?(a.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,a){i[a]=t.css(a),isNaN(parseInt(i[a],10))&&(i[a]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(s),a.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,a,s){return s=s||{},e.each(i,function(e,i){var r=t.cssUnit(i);r[0]>0&&(s[i]=r[0]*a+r[1])}),s}}),e.fn.extend({effect:function(){function t(t){function a(){e.isFunction(r)&&r.call(s[0]),e.isFunction(t)&&t()}var s=e(this),r=i.complete,o=i.mode;(s.is(":hidden")?"hide"===o:"show"===o)?(s[o](),a()):n.call(s[0],i,a)}var i=a.apply(this,arguments),s=i.mode,r=i.queue,n=e.effects.effect[i.effect];return e.fx.off||!n?s?this[s](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):r===!1?this.each(t):this.queue(r||"fx",t)},show:function(e){return function(t){if(s(t))return e.apply(this,arguments);var i=a.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(e.fn.show),hide:function(e){return function(t){if(s(t))return e.apply(this,arguments);var i=a.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(e.fn.hide),toggle:function(e){return function(t){if(s(t)||"boolean"==typeof t)return e.apply(this,arguments);var i=a.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),a=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(a=[parseFloat(i),t])}),a}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}()})(jQuery);(function(e){var t=/up|down|vertical/,i=/up|left|vertical|horizontal/;e.effects.effect.blind=function(a,s){var r,n,o,l=e(this),h=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(l,a.mode||"hide"),d=a.direction||"up",c=t.test(d),p=c?"height":"width",m=c?"top":"left",f=i.test(d),g={},y="show"===u;l.parent().is(".ui-effects-wrapper")?e.effects.save(l.parent(),h):e.effects.save(l,h),l.show(),r=e.effects.createWrapper(l).css({overflow:"hidden"}),n=r[p](),o=parseFloat(r.css(m))||0,g[p]=y?n:0,f||(l.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[m]=y?o:n+o),y&&(r.css(p,0),f||r.css(m,o+n)),r.animate(g,{duration:a.duration,easing:a.easing,queue:!1,complete:function(){"hide"===u&&l.hide(),e.effects.restore(l,h),e.effects.removeWrapper(l),s()}})}})(jQuery);(function(e){e.effects.effect.bounce=function(t,i){var a,s,r,n=e(this),o=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(n,t.mode||"effect"),h="hide"===l,u="show"===l,d=t.direction||"up",c=t.distance,p=t.times||5,m=2*p+(u||h?1:0),f=t.duration/m,g=t.easing,y="up"===d||"down"===d?"top":"left",v="up"===d||"left"===d,b=n.queue(),x=b.length;for((u||h)&&o.push("opacity"),e.effects.save(n,o),n.show(),e.effects.createWrapper(n),c||(c=n["top"===y?"outerHeight":"outerWidth"]()/3),u&&(r={opacity:1},r[y]=0,n.css("opacity",0).css(y,v?2*-c:2*c).animate(r,f,g)),h&&(c/=Math.pow(2,p-1)),r={},r[y]=0,a=0;p>a;a++)s={},s[y]=(v?"-=":"+=")+c,n.animate(s,f,g).animate(r,f,g),c=h?2*c:c/2;h&&(s={opacity:0},s[y]=(v?"-=":"+=")+c,n.animate(s,f,g)),n.queue(function(){h&&n.hide(),e.effects.restore(n,o),e.effects.removeWrapper(n),i()}),x>1&&b.splice.apply(b,[1,0].concat(b.splice(x,m+1))),n.dequeue()}})(jQuery);(function(e){e.effects.effect.clip=function(t,i){var a,s,r,n=e(this),o=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(n,t.mode||"hide"),h="show"===l,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",m={};e.effects.save(n,o),n.show(),a=e.effects.createWrapper(n).css({overflow:"hidden"}),s="IMG"===n[0].tagName?a:n,r=s[c](),h&&(s.css(c,0),s.css(p,r/2)),m[c]=h?r:0,m[p]=h?0:r/2,s.animate(m,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){h||n.hide(),e.effects.restore(n,o),e.effects.removeWrapper(n),i()}})}})(jQuery);(function(e){e.effects.effect.drop=function(t,i){var a,s=e(this),r=["position","top","bottom","left","right","opacity","height","width"],n=e.effects.setMode(s,t.mode||"hide"),o="show"===n,l=t.direction||"left",h="up"===l||"down"===l?"top":"left",u="up"===l||"left"===l?"pos":"neg",d={opacity:o?1:0};e.effects.save(s,r),s.show(),e.effects.createWrapper(s),a=t.distance||s["top"===h?"outerHeight":"outerWidth"](!0)/2,o&&s.css("opacity",0).css(h,"pos"===u?-a:a),d[h]=(o?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+a,s.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&s.hide(),e.effects.restore(s,r),e.effects.removeWrapper(s),i()}})}})(jQuery);(function(e){e.effects.effect.explode=function(t,i){function a(){b.push(this),b.length===d*c&&s()}function s(){p.css({visibility:"visible"}),e(b).remove(),f||p.hide(),i()}var r,n,o,l,h,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),m=e.effects.setMode(p,t.mode||"hide"),f="show"===m,g=p.show().css("visibility","hidden").offset(),y=Math.ceil(p.outerWidth()/c),v=Math.ceil(p.outerHeight()/d),b=[];for(r=0;d>r;r++)for(l=g.top+r*v,u=r-(d-1)/2,n=0;c>n;n++)o=g.left+n*y,h=n-(c-1)/2,p.clone().appendTo("body").wrap("
").css({position:"absolute",visibility:"visible",left:-n*y,top:-r*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:y,height:v,left:o+(f?h*y:0),top:l+(f?u*v:0),opacity:f?0:1}).animate({left:o+(f?0:h*y),top:l+(f?0:u*v),opacity:f?1:0},t.duration||500,t.easing,a)}})(jQuery);(function(e){e.effects.effect.fade=function(t,i){var a=e(this),s=e.effects.setMode(a,t.mode||"toggle");a.animate({opacity:s},{queue:!1,duration:t.duration,easing:t.easing,complete:i})}})(jQuery);(function(e){e.effects.effect.fold=function(t,i){var a,s,r=e(this),n=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(r,t.mode||"hide"),l="show"===o,h="hide"===o,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=l!==c,m=p?["width","height"]:["height","width"],f=t.duration/2,g={},y={};e.effects.save(r,n),r.show(),a=e.effects.createWrapper(r).css({overflow:"hidden"}),s=p?[a.width(),a.height()]:[a.height(),a.width()],d&&(u=parseInt(d[1],10)/100*s[h?0:1]),l&&a.css(c?{height:0,width:u}:{height:u,width:0}),g[m[0]]=l?s[0]:u,y[m[1]]=l?s[1]:0,a.animate(g,f,t.easing).animate(y,f,t.easing,function(){h&&r.hide(),e.effects.restore(r,n),e.effects.removeWrapper(r),i()})}})(jQuery);(function(e){e.effects.effect.highlight=function(t,i){var a=e(this),s=["backgroundImage","backgroundColor","opacity"],r=e.effects.setMode(a,t.mode||"show"),n={backgroundColor:a.css("backgroundColor")};"hide"===r&&(n.opacity=0),e.effects.save(a,s),a.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(n,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&a.hide(),e.effects.restore(a,s),i()}})}})(jQuery);(function(e){e.effects.effect.pulsate=function(t,i){var a,s=e(this),r=e.effects.setMode(s,t.mode||"show"),n="show"===r,o="hide"===r,l=n||"hide"===r,h=2*(t.times||5)+(l?1:0),u=t.duration/h,d=0,c=s.queue(),p=c.length;for((n||!s.is(":visible"))&&(s.css("opacity",0).show(),d=1),a=1;h>a;a++)s.animate({opacity:d},u,t.easing),d=1-d;s.animate({opacity:d},u,t.easing),s.queue(function(){o&&s.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,h+1))),s.dequeue()}})(jQuery);(function(e){e.effects.effect.puff=function(t,i){var a=e(this),s=e.effects.setMode(a,t.mode||"hide"),r="hide"===s,n=parseInt(t.percent,10)||150,o=n/100,h={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:s,complete:i,percent:r?n:100,from:r?h:{height:h.height*o,width:h.width*o,outerHeight:h.outerHeight*o,outerWidth:h.outerWidth*o}}),a.effect(t)},e.effects.effect.scale=function(t,i){var a=e(this),s=e.extend(!0,{},t),r=e.effects.setMode(a,t.mode||"effect"),n=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===r?0:100),o=t.direction||"both",h=t.origin,l={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()},u={y:"horizontal"!==o?n/100:1,x:"vertical"!==o?n/100:1};s.effect="size",s.queue=!1,s.complete=i,"effect"!==r&&(s.origin=h||["middle","center"],s.restore=!0),s.from=t.from||("show"===r?{height:0,width:0,outerHeight:0,outerWidth:0}:l),s.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},s.fade&&("show"===r&&(s.from.opacity=0,s.to.opacity=1),"hide"===r&&(s.from.opacity=1,s.to.opacity=0)),a.effect(s)},e.effects.effect.size=function(t,i){var a,s,r,n=e(this),o=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(n,t.mode||"effect"),m=t.restore||"effect"!==p,f=t.scale||"both",g=t.origin||["middle","center"],y=n.css("position"),v=m?o:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&n.show(),a={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},"toggle"===t.mode&&"show"===p?(n.from=t.to||b,n.to=t.from||a):(n.from=t.from||("show"===p?b:a),n.to=t.to||("hide"===p?b:a)),r={from:{y:n.from.height/a.height,x:n.from.width/a.width},to:{y:n.to.height/a.height,x:n.to.width/a.width}},("box"===f||"both"===f)&&(r.from.y!==r.to.y&&(v=v.concat(d),n.from=e.effects.setTransition(n,d,r.from.y,n.from),n.to=e.effects.setTransition(n,d,r.to.y,n.to)),r.from.x!==r.to.x&&(v=v.concat(c),n.from=e.effects.setTransition(n,c,r.from.x,n.from),n.to=e.effects.setTransition(n,c,r.to.x,n.to))),("content"===f||"both"===f)&&r.from.y!==r.to.y&&(v=v.concat(u).concat(l),n.from=e.effects.setTransition(n,u,r.from.y,n.from),n.to=e.effects.setTransition(n,u,r.to.y,n.to)),e.effects.save(n,v),n.show(),e.effects.createWrapper(n),n.css("overflow","hidden").css(n.from),g&&(s=e.effects.getBaseline(g,a),n.from.top=(a.outerHeight-n.outerHeight())*s.y,n.from.left=(a.outerWidth-n.outerWidth())*s.x,n.to.top=(a.outerHeight-n.to.outerHeight)*s.y,n.to.left=(a.outerWidth-n.to.outerWidth)*s.x),n.css(n.from),("content"===f||"both"===f)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=o.concat(d).concat(c),n.find("*[width]").each(function(){var i=e(this),a={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};m&&e.effects.save(i,l),i.from={height:a.height*r.from.y,width:a.width*r.from.x,outerHeight:a.outerHeight*r.from.y,outerWidth:a.outerWidth*r.from.x},i.to={height:a.height*r.to.y,width:a.width*r.to.x,outerHeight:a.height*r.to.y,outerWidth:a.width*r.to.x},r.from.y!==r.to.y&&(i.from=e.effects.setTransition(i,d,r.from.y,i.from),i.to=e.effects.setTransition(i,d,r.to.y,i.to)),r.from.x!==r.to.x&&(i.from=e.effects.setTransition(i,c,r.from.x,i.from),i.to=e.effects.setTransition(i,c,r.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){m&&e.effects.restore(i,l)})})),n.animate(n.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===n.to.opacity&&n.css("opacity",n.from.opacity),"hide"===p&&n.hide(),e.effects.restore(n,v),m||("static"===y?n.css({position:"relative",top:n.to.top,left:n.to.left}):e.each(["top","left"],function(e,t){n.css(t,function(t,i){var a=parseInt(i,10),s=e?n.to.left:n.to.top;return"auto"===i?s+"px":a+s+"px"})})),e.effects.removeWrapper(n),i()}})}})(jQuery);(function(e){e.effects.effect.shake=function(t,i){var a,s=e(this),r=["position","top","bottom","left","right","height","width"],n=e.effects.setMode(s,t.mode||"effect"),o=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===o||"down"===o?"top":"left",p="up"===o||"left"===o,m={},f={},g={},y=s.queue(),v=y.length;for(e.effects.save(s,r),s.show(),e.effects.createWrapper(s),m[c]=(p?"-=":"+=")+h,f[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,s.animate(m,d,t.easing),a=1;l>a;a++)s.animate(f,d,t.easing).animate(g,d,t.easing);s.animate(f,d,t.easing).animate(m,d/2,t.easing).queue(function(){"hide"===n&&s.hide(),e.effects.restore(s,r),e.effects.removeWrapper(s),i()}),v>1&&y.splice.apply(y,[1,0].concat(y.splice(v,u+1))),s.dequeue()}})(jQuery);(function(e){e.effects.effect.slide=function(t,i){var a,s=e(this),r=["position","top","bottom","left","right","width","height"],n=e.effects.setMode(s,t.mode||"show"),o="show"===n,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(s,r),s.show(),a=t.distance||s["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(s).css({overflow:"hidden"}),o&&s.css(l,u?isNaN(a)?"-"+a:-a:a),d[l]=(o?u?"+=":"-=":u?"-=":"+=")+a,s.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&s.hide(),e.effects.restore(s,r),e.effects.removeWrapper(s),i()}})}})(jQuery);(function(e){e.effects.effect.transfer=function(t,i){var a=e(this),s=e(t.to),r="fixed"===s.css("position"),n=e("body"),o=r?n.scrollTop():0,h=r?n.scrollLeft():0,l=s.offset(),u={top:l.top-o,left:l.left-h,height:s.innerHeight(),width:s.innerWidth()},d=a.offset(),c=e("
").appendTo(document.body).addClass(t.className).css({top:d.top-o,left:d.left-h,height:a.innerHeight(),width:a.innerWidth(),position:r?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})}})(jQuery)
/* ---------------------UUUUUUUUUUUUU---------------------------------- */
var banner=1;
var bannerTimer = "";
var basketDivTimer = "";
var runOutT = "";
var minmax= new Array();
var menuHeight = 0;
var focus_= '';
var num = 0;
var numInterval = ''
var bottomShow=0;
if( $(window).width()<769)
{
// $(document).ready(function() {
// function disableBack() { window.history.forward() }
// window.onload = disableBack();
// window.onpageshow = function(evt) { if (evt.persisted) disableBack() }
// });
};
function winOpen( obj )
{
window.open( $(obj).attr('href') , "targetWindow" , "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=400" );
};
function myDataSubmit()
{
if( $('#erasure').is(':checked') )
{
if( confirm( javaText[1078] ) )
{
return true;
}
return false;
}
else
{
return true;
}
}
$(window) . resize( function() { if( this . resizeTO ) { clearTimeout( this . resizeTO ); }; this . resizeTO = setTimeout( function() { $( this ) . trigger( "resizeEnd" ); }, 200); } );
$(window) . bind( "resizeEnd" , function(){ resizeFunction(); } );
function resizeFunction()
{
fitt();
};
$(function() {
$(document).on('click', '.basketDiv' , function (e)
{
showProduct(this);
});
});
$(function() {
$(document).on('change', '#address-1' , function ()
{
if( $('#deliver_mode2').length < 1 )
{
return false;
}
else if( $('#deliver_mode1').is(':checked') )
{
$('#deliver_mode1').trigger('click');
}
else if( $('#deliver_mode2').is(':checked') )
{
$('#deliver_mode2').trigger('click');
}
});
});
$(window) . ready( function()
{
firmCall( 3 );
$('.reLoad').each( function(){
pic_ = $(this).attr('class') . replace('reLoad ' , '' ) ;
$(this).attr('src',pic_).attr('title','');
});
$('.tn').click(function(){
var picsrc = $(this) .attr('src');
idA = $(this) .attr('src').toString().split('/');
var asrc = 'bp' + idA[idA.length - 1].toString() .replace('.jpg','');
if( $('#bigPic').attr( 'src') == picsrc ){return false;}
$('.tn').removeClass('tnHide');
$(this).addClass('tnHide');
$('#bigPic'). fadeTo(250,0 , function(){
$('#bigPic').attr( 'src' , picsrc ).fadeTo(250,1);
$('#'+asrc).length == 1 ? $('#bigPic').addClass('pointer') : removeClass('pointer');
});
});
$('#bigPic').click(function(){
idA = $(this) .attr('src').toString().split('/');
var asrc = 'bp' + idA[idA.length - 1].toString() .replace('.jpg','');
$('#'+asrc).trigger('click');
});
if( $('#basketCTable').length == 1)
{
$("#basket").remove();
};
$('.backtotop').click(function()
{
$("html, body").animate({ scrollTop: 0 }, 600 , 'easeOutExpo');
return false;
});
$('#fastClose').click(function(){
$('#fastProduct').stop(true,false).hide('fast', function(){ $('#fastContent').html(''); } );
}) ;
$( "#rotatorContainer" ).hover(
function() {
clearTimeout(bannerTimer);
$('#shadow').hide();
}, function() {
bannerTimer = setTimeout(function(){ rotator(1); }, 3000);
$('#shadow').show();
}
);
if( $('.remaind').length == 1 )
{
numInterval = setInterval(function()
{
var num = $('.remaind').attr('id');
if( num%10 == 0 )
{
$.ajax( PREURL_ + PREDIR_ + 'open/getRemind.php' )
.done(function( result )
{
$('.remaind').attr('id' , result ) ;
});
}
if( num*1 <1 ){ self.location=self.location; }
$('.remaind').text( getTime( num ) ); $('.remaind').attr('id' , (num-1) );
}, 1000);
} ;
$('.conterContH, .conterCont').each(function(){
if( $(this).find('span').text() * 1 > 0 )
{ $(this).fadeTo(200,1); }
});
importantAlert();
formRequired();
regCheck();
$(document).on('mouseover' , '#userMenuBasket, .basketCount' , function(e)
{
if( $('#basketDiv').length == 1 && $('.bT1').length>0 )
{
$('#basketDiv').stop(true,true).show();
clearTimeout(basketDivTimer);
leftBD = e.pageX - parseInt($('#basketDiv').width()/2) ;
topBD = e.pageY + $(this).height();
maxL = $(window).width() - $('#basketDiv').width() - 50;
maxT = $(window).height() - $('#basketDiv').height();
if(leftBD>maxL){ leftBD=maxL;}
if(leftBD<1){leftBD=0;}
$('#basketDiv') . css('left' , leftBD) . css('top',topBD);
}
});
$(document).on( 'mouseout' , '#userMenuBasket, .basketCount , #basketDiv' , function()
{
basketDivTimer = setTimeout(function(){ $('#basketDiv').hide(); }, 600);
});
$('#basketDiv').mouseover(function()
{
clearTimeout(basketDivTimer);
});
$('#myBasket').click( function(){ basketFlipFlop(this); } );
$('#myBasketM').click( function(){ basketFlipFlop(this); } );
$('#basketDetailsHead').click( function(){ basketFlipFlop(this); } );
$(".noLink").click(function(e){e.preventDefault();});
if( getCookie('cta') == 1)
{
$('#cookieAgree').remove();
};
$('#cookieAgree button').click(function()
{
$('#cookieAgree').remove();
document.cookie="cta=1";
});
$('#hamburger').click(function(){ $('#mobileMenu').toggle('slow');});
$(".plusB, .plusBA, .minusB").click( function()
{
toBasketClick( this );
});
$("#myAlertDiv").click(function()
{
$("#myAlertDiv").hide();
basketUri = PREURL_ + PREDIR_ + "open/alwaysAlert.php?ok=1";
$.ajax( basketUri )
}) ;
$( ".onlyNumber , .onlyNumberFloat" ) . keyup( function(event)
{
var v = $(this).val().replace(",", ".").replace(/([^0-9\.]+)/ , '' );
$(this).val(v);
} ) ;
fitt();
$('#prev').click(function(e){
e.preventDefault();
rotator( -1 );
});
$('#next').click(function(e){
e.preventDefault();
rotator( 1 );
});
if( $('.bannerItem').length>1)
{
bannerTimer = setTimeout(function(){ rotator(1); }, 5000);
} ;
$('.mainCat').mouseover(
function() {
$('a[id^="mm"]').css('display','none');
$('a[id^="m' + $(this).attr('id') + '_"]').css('display','block');
});
basketCall( '' , 0 );
});
function toBasketClick( obj)
{
id=$(obj).attr("id");
if( $(obj).hasClass('plusBN') ){ return false;}
q=0;
if( /bp/.test(id))
{
id = id.replace('bp','');
q = 1;
}
else if( /bm/.test(id))
{
id = id.replace('bm','');
q = -1;
} ;
figyu = $(obj).closest('tr').attr("data-dbA");
if( figyu != 1 && q>0 )
{
if( !confirm( javaText[1068] ) )
{
return false;
}
} ;
if( $("#bigPic").length == 1 && q > 0)
{
$("#flyBasket").stop(true,true);
pL = $("#bigPic").offset().left;
pT = $("#bigPic").offset().top;
pW = $("#bigPic").innerWidth();
pH = $("#bigPic").height();
fL = $('#bn'+id).offset().left;
fT = $('#bn'+id).offset().top;
$("#flyBasket")
. css("left" , pL )
. css("top" , pT )
.css("width" , pW)
.css("height", pH)
. attr("src" , $("#bigPic").attr("src") )
.fadeTo(0,1)
. show()
.stop(true,true)
.animate({ top: fT , left: fL , opacity: 0.5, width: 0 , height: 0 }, "slow" , function(){ $("#flyBasket").attr('src',PREURL_+PREDIR_+"theme/tr.gif"); });
}
else if( $("#bigPic").length == 1 && q < 1)
{
$("#flyBasket").stop(true,true);
pL = $("#bigPic").offset().left;
pT = $("#bigPic").offset().top;
pW = $("#bigPic").innerWidth();
pH = $("#bigPic").height();
fL = $('#bn'+id).offset().left;
fT = $('#bn'+id).offset().top;
$("#flyBasket")
. css("left" , fL )
. css("top" , fT )
.css("width" , 0)
.css("height", 0)
. attr("src" , $("#bigPic").attr("src") )
.fadeTo(0,1)
. show()
.stop(true,true)
.animate({ top: pT , left: pL , opacity: 0.5, width: pW , height: pH }, "slow" , function(){ $("#flyBasket").attr('src',PREURL_+PREDIR_+"theme/tr.gif"); });
}
basketCall( id , q );
};
function runOut()
{
clearTimeout(runOutT);
$(".runOut").hide("slow",function(){
$(".runOut").remove();
});
} ;
function basketDel( id )
{
basketCall( id , -10000 )
} ;
function triggerBasketCall( id , quantity )
{
$("#TBBP").find("button").trigger("click");
return false;
} ;
function basketCall( id , quantity , set )
{
deliver = "no";
id == -1 || id == -2 || id == -3 || id == -4 || id == -11 || id == -12 ?
basketUri = PREURL_ + PREDIR_ + "open/basket.php?ver="+ Math.random() +"'&d=" + id + "&q=0&id=" :
basketUri = PREURL_ + PREDIR_ + "open/basket.php?ver="+ Math.random() +"'&d=" + deliver + "&q=" + quantity + "&id=" + id + "&cashT=" + $('#basketCashTableContainer').length ;
if( id== 'set' && quantity == 0 && typeof set != typeof undefined )
{
basketUri += '&setContent=' + set;
//alert( basketUri);return false;
}
$.ajax( basketUri )
.done(function( result )
{
if( $('#basketCashTableContainer').length != 1 )
{
var resultA = result . split("::SeP::");
$('.basketContent').html(resultA[0]);
basketResize();
resultA[1] > 0 ? $('.basketOverall').html(resultA[1] + ' ' + javaText[1013]) : $('.basketOverall').html( javaText[43]);
resultA[4] > 0 ?
$('#bn'+resultA[3]).text(resultA[4]).removeClass('countH') :
$('#bn'+resultA[3]).text('').addClass('countH');
resultA[4] > 0 ?
$('#bm'+resultA[3]).removeClass('hide') :
$('#bm'+resultA[3]).addClass('hide');
resultA[4] > 0 ?
$('#bm'+resultA[3]).closest('td').removeClass('atc3Hide') :
$('#bm'+resultA[3]).closest('td').addClass('atc3Hide');
if( resultA[4]*1
0)
{ $('#bp'+resultA[3]).removeClass('plusB').removeClass('plusBA').removeClass('plusBN').addClass('plusBA').removeAttr('title');}
else if( resultA[4]*1>=resultA[5]*1 && resultA[4]*1>0)
{ $('#bp'+resultA[3]).removeClass('plusB').removeClass('plusBA').removeClass('plusBN').addClass('plusBN').removeAttr('title').attr('title' , javaText[41].replace('#',resultA[4]) );}
else
{ $('#bp'+resultA[3]).removeClass('plusB').removeClass('plusBA').removeClass('plusBN').addClass('plusB').removeAttr('title');}
$(".plusB, .plusBA, .minusB").unbind( "click" ).click(function()
{
toBasketClick( this );
}) ;
$('.basketSum').html( resultA[2]);
if( resultA[1] < 1)
{
// $('.basketContent').html(javaText[43]);
}
}
else
{
$('#basketCashTableContainer').html(result);
}
$('#pay_mode3').is(':checked') ? $('#sipleAgree').show() : $('#sipleAgree').hide();
$('#pay_mode3').is(':checked') ? $('#checkSP').attr('required','required') : $('#checkSP').removeAttr('required');
});
};
function importantAlert()
{
basketUri = PREURL_ + PREDIR_ + "open/alwaysAlert.php";
$.ajax( basketUri )
.done(function( result )
{
if(result!='')
{
if( jQuery("#myAlertDiv").is(':animated')){ return false;}
jQuery("#myAlertDiv").stop(true,true).find("div").find("div").html(result).end().end().width( jQuery(window).width() ).css('top' , '0px') .show( "slide" , 700 );
// setTimeout( function(){ jQuery("#myAlertDiv").stop(true,true).hide( "slide" , 700 );} , time_);
}
});
} ;
function deliverCall( id )
{
basketUri = PREURL_ + PREDIR_ + "open/basket.php?ver="+ Math.random() +"'&d=" + id + "&q=0&id=&cashT=1&co=" + $('#address-1').val();
$.ajax( basketUri )
.done(function( result )
{
$('#basketCashTableContainer').html(result);
$('#pay_mode3').is(':checked') ? $('#sipleAgree').show() : $('#sipleAgree').hide();
$('#pay_mode3').is(':checked') ? $('#checkSP').attr('required','required') : $('#checkSP').removeAttr('required');
}) ;
} ;
function couponSend()
{
if( $('#coupon').length!=1 || $('#coupon').val() == ''){ return false;}
basketUri = PREURL_ + PREDIR_ + "open/basket.php?ver="+ Math.random() +"'&coupon=" + $('#coupon').val() + "&cashT=1";
$.ajax( basketUri )
.done(function( result )
{
$('#basketCashTableContainer').html(result);
}) ;
} ;
$(window) . load( function()
{
setTimeout(function(){
$( window ).mousemove(function( event )
{
if( bottomShow == 0 )
{
REQUESTURI_ = self.location.toString();
bottomShow=1;
$('#bottomTextP').html(BottomText);
$('#analyticsDiv').html("");
$('#fbDiv').html('
');
}
if ($(this).scrollTop() > 200)
{
$('.backtotop').addClass('shown');
}
else
{
$('.backtotop').removeClass('shown');
}
});
}, 1000);
fitt();
/* if( $(window).width()<1020 && $('#rotatorContainer').length<1)
{
$("html, body").animate({ scrollTop: $('#rightContainer').offset().top }, 600 , 'easeOutExpo');
} ; */
});
function fitt()
{
if( $(window).width()>768 )
{
$('#mobileMenu').hide();
$('#basketDetails').hide();
}
$("#rotatorContainer").height( $('#shadow').height() );
$('#banners') . height( $('#shadow').height()) . width( $("#shadow").width()*$(".bannerItem").length ) .css('left', $("#shadow").width()*-1+"px");
$(".bannerItem").css("width",$('#shadow').width()+"px");
};
function rotator( m )
{
if( $("#banners:animated").length>0 ){return false;}
clearTimeout(bannerTimer);
banner += m;
newPos = banner * $("#shadow").width() * -1;
$('#banners').stop(true,true).animate({ left: newPos}, 1200 , "easeInOutQuint" , function(e)
{
if( banner == 0){ $('#banners').css('left' , ($('.bannerItem').length-2)*-1*$('#shadow').width() ); banner = $('.bannerItem').length-2; }
if( banner == $('.bannerItem').length-1){ $('#banners').css('left' , -1*$('#shadow').width() ); banner = 1; }
if( currentClass != 'bannerImg')
{bannerTimer = setTimeout(function(){ rotator(1); }, 5000);}
});
};
var currentClass = currentId = '';
$(window).on("mousemove", function(e)
{
var x = e.clientX, y = e.clientY,
elementMouseIsOver = document.elementFromPoint(x, y);
currentClass = $(elementMouseIsOver).attr('class');
currentId = $(elementMouseIsOver).attr('id');
});
$(document).ready(function() { $("a.fancyA1").attr('rel','tag'); $("a.fancyA2").attr('rel','tag2') ; $("a.fancyA").fancybox({ 'transitionIn':'elastic', 'transitionOut':'elastic', 'overlayOpacity':0.8, 'overlayColor':'#000', 'titlePosition':'outside', 'titleFormat':function(title, currentArray, currentIndex, currentOpts) { return '' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '<\/span>'; } }); });
function copyData (mode)
{
if($("#nameR").length==1)
{$("#dname").val( $("#nameR").val() );}
else if($("#name").length==1)
{$("#dname").val( $("#name").val() );}
$("#dzip").val( $("#zip").val() );
$("#dcity").val( $("#city").val() );
$("#daddress").val( $("#address").val() );
$("#daddress0").val( $("#address0").val() );
$("#daddress1").val( $("#address1").val() );
$("#daddress2").val( $("#address2").val() );
$("#daddress3").val( $("#address3").val() );
$("#daddress4").val( $("#address4").val() );
$("#daddress5").val( $("#address5").val() );
};
function getCity( zip , city )
{
} ;
function jump( to )
{
$('html, body').stop(true,false).animate({
scrollTop: $("#regisztracio").offset().top - 90
}, 500);
$("#"+to).val("").focus();
} ;
function jumpObj( obj )
{
bT = $(obj).offset().top - 170;
$('html, body').stop(true,false).animate({
scrollTop: bT
}, 500);
} ;
$(function() {
$('.ajaxForm').on('submit', function (e)
{
e.preventDefault();
if( $(this).find("input[name='myForm']").val() == 'order' )
{
if ( $('#check4').length == 1 && !$('#check4:checked').length )
{
myTipp( $("#check4") );
return false;
}
else if ($("#deliverMode1").length==1 && $("input[type='radio'][name='deliverMode']:checked").length != 1)
{
myTipp( $("#deliverMode1") );
return false;
}
else if ($("#payMode1").length==1 && $("input[type='radio'][name='payMode']:checked").length != 1)
{
myTipp( $("#payMode1") );
return false;
}
}
var serializedData = $(this).serialize();
request = $.ajax(
{
url: PREURL_ + PREDIR_ + "open/makeProcesses.php",
type: "post",
data: serializedData
});
request.done(function (response, textStatus, jqXHR)
{
//alert(response);
$(".ajaxForm").find('input').css("background-color","#FFFFFF");
$("#dm1, #dm2, #dm3").css("background-color","#FFFFFF");
$("#flyNobasket").html(response)
//alert(response);
});
});
});
function myAlert( string_ , time_ )
{
if( jQuery("#myAlertDiv").is(':animated')){ return false;}
if( isNaN(time_) ){ time_ = 5000; }
jQuery("#myAlertDiv").stop(true,true).find("div").find("div").html(string_).end().end().width( jQuery(window).width() ).css('top' , '0px') .show( "slide" , 700 );
setTimeout( function(){ jQuery("#myAlertDiv").stop(true,true).hide( "slide" , 700 );} , time_);
} ;
function myAlertAlways( str )
{
$("#myAlertDiv").html(str);
l = parseInt(($(window).width() - $("#myAlertDiv").width()) / 2 );
t = parseInt(($(window).height() - $("#myAlertDiv").height()) / 2 )-100;
$("#myAlertDiv").css("left",l).css("top",t).show("pulsate" );
} ;
function clearForm( formId )
{
$("#"+formId).find("input").val("").css("box-shadow","none");
$("#"+formId).find(":radio").attr("checked",false);
$("#"+formId).find(":checkbox").attr("checked",false);
};
function getCookie(cname)
{
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i ' + responseA[0] + '
' + responseA[1] ).show('slow');
formRequired();
$('#bodyContent').addClass('bodyContentFixed');
if( focus_ !='')
{
$(focus_).focus();
}
});
} ;
function resetForm()
{
$('#bodyContent').removeClass('bodyContentFixed');
$('#shadow').hide();
$('#formContainer').hide('slow' , function(){ $('#formContainer').html('');}) ;
} ;
function forgetFormF( obj )
{
if( $(obj).closest('form').attr('id') == 'loginForm')
{
$('#loginForm').fadeTo('slow',0, function(){$('#formError2').html(' ');$('#formError').html(' '); $('#loginForm').hide(); $('#forgetForm').show().fadeTo(0,0).fadeTo('slow',1);$('#emailF').focus(); });
}
else
{
$('#forgetForm').fadeTo('slow',0, function(){$('#formError2').html(' ');$('#formError').html(' '); $('#forgetForm').hide(); $('#loginForm').show().fadeTo(0,0).fadeTo('slow',1);$('#emailL').focus(); });
}
} ;
$(function() {
$(document).on('submit', '.ajaxForm' , function (e)
{
e.preventDefault();
var serializedData = $(this).serialize();
request = $.ajax(
{
url: PREURL_ + PREDIR_ + "open/form.php",
type: "post",
data: serializedData
});
request.done(function (response, textStatus, jqXHR)
{
responseA = response . split("::SeP::");
$('#formContainer').html( '
' + responseA[1] ).show('slow');
formRequired();
});
});
});
function newPasswordRequired()
{
labelO = $('#password').closest('.form-group').find('label');
$(labelO).html( $(labelO).text().replace(/\*/,"") );
labelO2 = $('#repassword').closest('.form-group').find('label');
$(labelO2).html( $(labelO2).text().replace(/\*/,"") );
if( $('#password').val() != '' || $('#repassword').val() != '')
{
$('#password').attr('required','required');
$('#repassword').attr('required','required');
$(labelO).html ( $(labelO).html()+" *");
$(labelO2).html( $(labelO2).html()+" *");
}
else
{
$('#password').removeAttr('required');
$('#repassword').removeAttr('required');
}
} ;
function beep()
{
var snd = new Audio(PREURL_ + PREDIR_ + "theme/ring.wav");
snd.play();
} ;
var mouseX, mouseY;
$(document).mousemove(function(e)
{
mouseX = e.pageX;
mouseY = e.pageY;
}).mouseover();
function regCheck()
{
if( $('#regForm').length == 1 || $('#widthReg').length != 1)
{
return false;
}
else if( $('#widthReg').is(':checked'))
{
$('#passwordDiv').show('slow');
$('#passwordR').attr('required','required');
$('#repassword').attr('required','required');
$('.regNeed').show();
$('#check').attr('required','required');
}
else
{
$('#passwordDiv').hide('slow');
$('#passwordR').removeAttr('required').html('');
$('#repassword').removeAttr('required').html('');
$('.regNeed').hide();
$('#check').removeAttr('required');
}
} ;
function getTime( num_ )
{
h = Math.floor( num_/60/60 );
r = num_ - h*60*60;
m = Math.floor( r/60 );
s = r - m*60;
if( h<10){ h = '0' + h; }
if( m<10){ m = '0' + m; }
if( s<10){ s = '0' + s; }
return h + ':' + m + ':' + s;
} ;
function basketFlipFlop( obj )
{
$('#fastProduct').stop(true,false).hide('fast', function(){ $('#fastContent').html(''); } );
if( $('#basketCTable').length == 1)
{
$('#basketDetails').hide();
return false;
}
$('#basketDetails').stop(true,true);
$('#basketDetails').toggle();
PL = $(obj).offset().left + $(obj).outerWidth() - $('#basketDetails').outerWidth();
PT = $(obj).offset().top;
if( $(obj).attr('id')=='myBasket'){PT+=5;}
$('#basketDetails').css('top',PT).css('left',PL);
} ;
function basketResize()
{
if( $('#basketDetails').is(':visible') )
{
obj = $('#myBasket').is(':visible') ? $('#myBasket') : $('#myBasketM');
$('#basketDetails').stop(true,true);
PL = $(obj).offset().left + $(obj).outerWidth() - $('#basketDetails').outerWidth();
PT = $(obj).offset().top;
if( $(obj).attr('id')=='myBasket'){PT+=5;}
$('#basketDetails').css('top',PT).css('left',PL);
}
} ;
function priceChange(obj)
{
var mode = $(obj).hasClass('priceChangePlus') ? 1 : -1;
var id = $(obj).attr('id').replace('pb','')
$.ajax( PREURL_ + PREDIR_ + 'open/wishList.php?mode=' + mode + '&product=' + id )
.done(function( result )
{
result == 1 ?
$(obj).text(javaText[88]).removeClass('priceChangePlus').addClass('priceChangeMinus') :
$(obj).text(javaText[100]).addClass('priceChangePlus').removeClass('priceChangeMinus');
});
};
function showProduct(obj)
{
id = $(obj).attr('id').replace('bdh','');
id = id.replace('bd','');
$.ajax( PREURL_ + PREDIR_ + 'open/fastProduct.php?pr=' + id )
.done(function( result )
{
$('#fastContent').html(result);
$('#fastProduct').stop(true,false).css('position', 'fixed') . css('top','20px'). show('fast' , function(){
h = $('#fastProduct').offset().top;
$('#fastProduct').css('top', h).css('position','absolute');
$(".plusB, .plusBA, .minusB").unbind( "click" ).click(function()
{
toBasketClick( this );
}) ;
});
});
} ;
$(function() {
$(document).on('keyup', '#searchI' , function (e)
{
if( $('#searchI').val().length < 3){ return false;}
var serializedData = 'search=' + $('#searchI').val();
request = $.ajax(
{
url: PREURL_ + PREDIR_ + "open/ajaxSearch.php",
type: "post",
data: serializedData
});
request.done(function (response, textStatus, jqXHR)
{
if( response != '' )
{
$('.noLink').removeClass('noLink').unbind('click');
$('#mainContent').html(response);
$('#container').css('height','auto');
}
});
});
});
function firmCall( m )
{
if( $('#customerType2') . length < 1 )
{
return false;
}
if( m == 3 )
{
m = $('#customerType2') .is(':checked') ? 2 : 1;
}
if( m==3 && /^([0-9]{8})-(1|2|4)-(02|22|03|23|04|24|05|25|06|26|07|27|08|28|09|29|10|30|11|31|12|32|13|33|14|34|15|35|16|36|17|37|18|38|19|39|20|40|41|42|43|44|51)$/ .test( $('#firmNumber').val() ) )
{
m=2;
$('#customerType2') . prop("checked", true);
}
$('#firmNumberLabel').html( $('#firmNumberLabel').html() .replace( / \*/g , '' ) );
if( m==2 )
{
$('#firmNumber').removeAttr('readonly').attr('required','required');
$('#firmNumberLabel').html( $('#firmNumberLabel').html() + ' *' );
}
else
{
$('#firmNumber').val('').removeAttr('required').attr('readonly','readonly');
}
}
$(document).on('click','#ppuux',function()
{
$('#ppuu').remove();
document.cookie = "nopopup=1";
})
$( document ) . on( 'change' , '.setSelect' , function()
{
id = $( this ) . attr( 'id' ) . replace( 'select_' , 'p_' );
$( '#'+id) . attr('data-price','0') . attr('data-price', $(this).find('option:selected').attr('data-price') ) . find( 'span' ) . text( '') . text( $(this).find('option:selected').attr('data-size') );
basketok();
} );
function basketok()
{
var sum_ = 0;
var m= 0;
$( '.setValue' ) . each( function()
{
if( ($(this).find('span').length == 0 || $(this).find('span').text() != '' ) && parseFloat( $(this).attr('data-price') )>0 )
{
sum_ += parseFloat( $(this).attr('data-price') * $(this).attr('data-quantity') );
}
else
{
m = 1;
}
});
if( m==0 )
{
sumSave_ = sum_;
sumFull_ = '
' + sum_.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ") + ',-Ft';
sum_ = Math.round( parseFloat( $('#setContent').attr('data-percent') ) * sum_ );
sumSave_ -= sum_;
sum_ = sum_.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
sumIn_ = '
' + sumSave_.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ") + ',-Ft';
$('#setPriceFull').html(sumFull_);
$('#setPriceIn').html(sumIn_);
$('#setPriceSave').html(sumSave_);
$( '#setBasketButton').show();
$( '#setButton').hide();
}
else
{
$('#setPriceFull').html('');
$('#setPriceIn').html('');
$('#setPriceSave').html('');
$( '#setBasketButton').hide();
$( '#setButton').show();
}
}
function setBasket()
{
var serializedData = $('#setForm').serialize();
serializedData = window . btoa( unescape( encodeURIComponent( serializedData ) ) );
basketCall( 'set' , 0 , serializedData );
$("#flyBasket").stop(true,true);
pL = $("#leftProduct").find('img:eq(0)').offset().left;
pT = $("#leftProduct").find('img:eq(0)').offset().top-100;
pW = $("#leftProduct").find('img:eq(0)').innerWidth();
pH = $("#leftProduct").find('img:eq(0)').height();
fL = $('#setBasketButton').offset().left;
fT = $('#setBasketButton').offset().top;
$("#flyBasket")
. css("left" , pL )
. css("top" , pT )
.css("width" , pW)
.css("height", pH)
. attr("src" , $("#leftProduct").find('img:eq(0)').attr("src") )
.fadeTo(0,1)
. show()
.stop(true,true)
.animate({ top: fT , left: fL , opacity: 0.5, width: 10 , height: 10 }, "slow" , function(){ $("#flyBasket").attr('src',PREURL_+PREDIR_+"theme/tr.gif"); });
}
/* ---------------------UUUUUUUUUUUUU---------------------------------- */
/*!
* fancyBox - jQuery Plugin
* version: 2.1.5 (Fri, 14 Jun 2013)
* @requires jQuery v1.6 or later
*
* Examples at http://fancyapps.com/fancybox/
* License: www.fancyapps.com/fancybox/#license
*
* Copyright 2012 Janis Skarnelis - janis@fancyapps.com
*
*/
(function (window, document, $, undefined) {
"use strict";
var H = $("html"),
W = $(window),
D = $(document),
F = $.fancybox = function () {
F.open.apply( this, arguments );
},
IE = navigator.userAgent.match(/msie/i),
didUpdate = null,
isTouch = document.createTouch !== undefined,
isQuery = function(obj) {
return obj && obj.hasOwnProperty && obj instanceof $;
},
isString = function(str) {
return str && $.type(str) === "string";
},
isPercentage = function(str) {
return isString(str) && str.indexOf('%') > 0;
},
isScrollable = function(el) {
return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
},
getScalar = function(orig, dim) {
var value = parseInt(orig, 10) || 0;
if (dim && isPercentage(orig)) {
value = F.getViewport()[ dim ] / 100 * value;
}
return Math.ceil(value);
},
getValue = function(value, dim) {
return getScalar(value, dim) + 'px';
};
$.extend(F, {
// The current version of fancyBox
version: '2.1.5',
defaults: {
padding : 15,
margin : 20,
width : 800,
height : 600,
minWidth : 100,
minHeight : 100,
maxWidth : 9999,
maxHeight : 9999,
pixelRatio: 1, // Set to 2 for retina display support
autoSize : true,
autoHeight : false,
autoWidth : false,
autoResize : true,
autoCenter : !isTouch,
fitToView : true,
aspectRatio : false,
topRatio : 0.5,
leftRatio : 0.5,
scrolling : 'auto', // 'auto', 'yes' or 'no'
wrapCSS : '',
arrows : true,
closeBtn : true,
closeClick : false,
nextClick : false,
mouseWheel : true,
autoPlay : false,
playSpeed : 3000,
preload : 3,
modal : false,
loop : true,
ajax : {
dataType : 'html',
headers : { 'X-fancyBox': true }
},
iframe : {
scrolling : 'auto',
preload : true
},
swf : {
wmode: 'transparent',
allowfullscreen : 'true',
allowscriptaccess : 'always'
},
keys : {
next : {
13 : 'left', // enter
34 : 'up', // page down
39 : 'left', // right arrow
40 : 'up' // down arrow
},
prev : {
8 : 'right', // backspace
33 : 'down', // page up
37 : 'right', // left arrow
38 : 'down' // up arrow
},
close : [27], // escape key
play : [32], // space - start/stop slideshow
toggle : [70] // letter "f" - toggle fullscreen
},
direction : {
next : 'left',
prev : 'right'
},
scrollOutside : true,
// Override some properties
index : 0,
type : null,
href : null,
content : null,
title : null,
// HTML templates
tpl: {
wrap : '
The requested content cannot be loaded. Please try again later.
'
},
// Properties for each animation type
// Opening fancyBox
openEffect : 'fade', // 'elastic', 'fade' or 'none'
openSpeed : 250,
openEasing : 'swing',
openOpacity : true,
openMethod : 'zoomIn',
// Closing fancyBox
closeEffect : 'fade', // 'elastic', 'fade' or 'none'
closeSpeed : 250,
closeEasing : 'swing',
closeOpacity : true,
closeMethod : 'zoomOut',
// Changing next gallery item
nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
nextSpeed : 250,
nextEasing : 'swing',
nextMethod : 'changeIn',
// Changing previous gallery item
prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
prevSpeed : 250,
prevEasing : 'swing',
prevMethod : 'changeOut',
// Enable default helpers
helpers : {
overlay : true,
title : true
},
// Callbacks
onCancel : $.noop, // If canceling
beforeLoad : $.noop, // Before loading
afterLoad : $.noop, // After loading
beforeShow : $.noop, // Before changing in current item
afterShow : $.noop, // After opening
beforeChange : $.noop, // Before changing gallery item
beforeClose : $.noop, // Before closing
afterClose : $.noop // After closing
},
//Current state
group : {}, // Selected group
opts : {}, // Group options
previous : null, // Previous element
coming : null, // Element being loaded
current : null, // Currently loaded element
isActive : false, // Is activated
isOpen : false, // Is currently open
isOpened : false, // Have been fully opened at least once
wrap : null,
skin : null,
outer : null,
inner : null,
player : {
timer : null,
isActive : false
},
// Loaders
ajaxLoad : null,
imgPreload : null,
// Some collections
transitions : {},
helpers : {},
/*
* Static methods
*/
open: function (group, opts) {
if (!group) {
return;
}
if (!$.isPlainObject(opts)) {
opts = {};
}
// Close if already active
if (false === F.close(true)) {
return;
}
// Normalize group
if (!$.isArray(group)) {
group = isQuery(group) ? $(group).get() : [group];
}
// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
$.each(group, function(i, element) {
var obj = {},
href,
title,
content,
type,
rez,
hrefParts,
selector;
if ($.type(element) === "object") {
// Check if is DOM element
if (element.nodeType) {
element = $(element);
}
if (isQuery(element)) {
obj = {
href : element.data('fancybox-href') || element.attr('href'),
title : element.data('fancybox-title') || element.attr('title'),
isDom : true,
element : element
};
if ($.metadata) {
$.extend(true, obj, element.metadata());
}
} else {
obj = element;
}
}
href = opts.href || obj.href || (isString(element) ? element : null);
title = opts.title !== undefined ? opts.title : obj.title || '';
content = opts.content || obj.content;
type = content ? 'html' : (opts.type || obj.type);
if (!type && obj.isDom) {
type = element.data('fancybox-type');
if (!type) {
rez = element.prop('class').match(/fancybox\.(\w+)/);
type = rez ? rez[1] : null;
}
}
if (isString(href)) {
// Try to guess the content type
if (!type) {
if (F.isImage(href)) {
type = 'image';
} else if (F.isSWF(href)) {
type = 'swf';
} else if (href.charAt(0) === '#') {
type = 'inline';
} else if (isString(element)) {
type = 'html';
content = element;
}
}
// Split url into two pieces with source url and content selector, e.g,
// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
if (type === 'ajax') {
hrefParts = href.split(/\s+/, 2);
href = hrefParts.shift();
selector = hrefParts.shift();
}
}
if (!content) {
if (type === 'inline') {
if (href) {
content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
} else if (obj.isDom) {
content = element;
}
} else if (type === 'html') {
content = href;
} else if (!type && !href && obj.isDom) {
type = 'inline';
content = element;
}
}
$.extend(obj, {
href : href,
type : type,
content : content,
title : title,
selector : selector
});
group[ i ] = obj;
});
// Extend the defaults
F.opts = $.extend(true, {}, F.defaults, opts);
// All options are merged recursive except keys
if (opts.keys !== undefined) {
F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
}
F.group = group;
return F._start(F.opts.index);
},
// Cancel image loading or abort ajax request
cancel: function () {
var coming = F.coming;
if (!coming || false === F.trigger('onCancel')) {
return;
}
F.hideLoading();
if (F.ajaxLoad) {
F.ajaxLoad.abort();
}
F.ajaxLoad = null;
if (F.imgPreload) {
F.imgPreload.onload = F.imgPreload.onerror = null;
}
if (coming.wrap) {
coming.wrap.stop(true, true).trigger('onReset').remove();
}
F.coming = null;
// If the first item has been canceled, then clear everything
if (!F.current) {
F._afterZoomOut( coming );
}
},
// Start closing animation if is open; remove immediately if opening/closing
close: function (event) {
F.cancel();
if (false === F.trigger('beforeClose')) {
return;
}
F.unbindEvents();
if (!F.isActive) {
return;
}
if (!F.isOpen || event === true) {
$('.fancybox-wrap').stop(true).trigger('onReset').remove();
F._afterZoomOut();
} else {
F.isOpen = F.isOpened = false;
F.isClosing = true;
$('.fancybox-item, .fancybox-nav').remove();
F.wrap.stop(true, true).removeClass('fancybox-opened');
F.transitions[ F.current.closeMethod ]();
}
},
// Manage slideshow:
// $.fancybox.play(); - toggle slideshow
// $.fancybox.play( true ); - start
// $.fancybox.play( false ); - stop
play: function ( action ) {
var clear = function () {
clearTimeout(F.player.timer);
},
set = function () {
clear();
if (F.current && F.player.isActive) {
F.player.timer = setTimeout(F.next, F.current.playSpeed);
}
},
stop = function () {
clear();
D.unbind('.player');
F.player.isActive = false;
F.trigger('onPlayEnd');
},
start = function () {
if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
F.player.isActive = true;
D.bind({
'onCancel.player beforeClose.player' : stop,
'onUpdate.player' : set,
'beforeLoad.player' : clear
});
set();
F.trigger('onPlayStart');
}
};
if (action === true || (!F.player.isActive && action !== false)) {
start();
} else {
stop();
}
},
// Navigate to next gallery item
next: function ( direction ) {
var current = F.current;
if (current) {
if (!isString(direction)) {
direction = current.direction.next;
}
F.jumpto(current.index + 1, direction, 'next');
}
},
// Navigate to previous gallery item
prev: function ( direction ) {
var current = F.current;
if (current) {
if (!isString(direction)) {
direction = current.direction.prev;
}
F.jumpto(current.index - 1, direction, 'prev');
}
},
// Navigate to gallery item by index
jumpto: function ( index, direction, router ) {
var current = F.current;
if (!current) {
return;
}
index = getScalar(index);
F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
F.router = router || 'jumpto';
if (current.loop) {
if (index < 0) {
index = current.group.length + (index % current.group.length);
}
index = index % current.group.length;
}
if (current.group[ index ] !== undefined) {
F.cancel();
F._start(index);
}
},
// Center inside viewport and toggle position type to fixed or absolute if needed
reposition: function (e, onlyAbsolute) {
var current = F.current,
wrap = current ? current.wrap : null,
pos;
if (wrap) {
pos = F._getPosition(onlyAbsolute);
if (e && e.type === 'scroll') {
delete pos.position;
wrap.stop(true, true).animate(pos, 200);
} else {
wrap.css(pos);
current.pos = $.extend({}, current.dim, pos);
}
}
},
update: function (e) {
var type = (e && e.type),
anyway = !type || type === 'orientationchange';
if (anyway) {
clearTimeout(didUpdate);
didUpdate = null;
}
if (!F.isOpen || didUpdate) {
return;
}
didUpdate = setTimeout(function() {
var current = F.current;
if (!current || F.isClosing) {
return;
}
F.wrap.removeClass('fancybox-tmp');
if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
F._setDimension();
}
if (!(type === 'scroll' && current.canShrink)) {
F.reposition(e);
}
F.trigger('onUpdate');
didUpdate = null;
}, (anyway && !isTouch ? 0 : 300));
},
// Shrink content to fit inside viewport or restore if resized
toggle: function ( action ) {
if (F.isOpen) {
F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
// Help browser to restore document dimensions
if (isTouch) {
F.wrap.removeAttr('style').addClass('fancybox-tmp');
F.trigger('onUpdate');
}
F.update();
}
},
hideLoading: function () {
D.unbind('.loading');
$('#fancybox-loading').remove();
},
showLoading: function () {
var el, viewport;
F.hideLoading();
el = $('
').click(F.cancel).appendTo('body');
// If user will press the escape-button, the request will be canceled
D.bind('keydown.loading', function(e) {
if ((e.which || e.keyCode) === 27) {
e.preventDefault();
F.cancel();
}
});
if (!F.defaults.fixed) {
viewport = F.getViewport();
el.css({
position : 'absolute',
top : (viewport.h * 0.5) + viewport.y,
left : (viewport.w * 0.5) + viewport.x
});
}
},
getViewport: function () {
var locked = (F.current && F.current.locked) || false,
rez = {
x: W.scrollLeft(),
y: W.scrollTop()
};
if (locked) {
rez.w = locked[0].clientWidth;
rez.h = locked[0].clientHeight;
} else {
// See http://bugs.jquery.com/ticket/6724
rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width();
rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
}
return rez;
},
// Unbind the keyboard / clicking actions
unbindEvents: function () {
if (F.wrap && isQuery(F.wrap)) {
F.wrap.unbind('.fb');
}
D.unbind('.fb');
W.unbind('.fb');
},
bindEvents: function () {
var current = F.current,
keys;
if (!current) {
return;
}
// Changing document height on iOS devices triggers a 'resize' event,
// that can change document height... repeating infinitely
W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
keys = current.keys;
if (keys) {
D.bind('keydown.fb', function (e) {
var code = e.which || e.keyCode,
target = e.target || e.srcElement;
// Skip esc key if loading, because showLoading will cancel preloading
if (code === 27 && F.coming) {
return false;
}
// Ignore key combinations and key events within form elements
if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
$.each(keys, function(i, val) {
if (current.group.length > 1 && val[ code ] !== undefined) {
F[ i ]( val[ code ] );
e.preventDefault();
return false;
}
if ($.inArray(code, val) > -1) {
F[ i ] ();
e.preventDefault();
return false;
}
});
}
});
}
if ($.fn.mousewheel && current.mouseWheel) {
F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
var target = e.target || null,
parent = $(target),
canScroll = false;
while (parent.length) {
if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
break;
}
canScroll = isScrollable( parent[0] );
parent = $(parent).parent();
}
if (delta !== 0 && !canScroll) {
if (F.group.length > 1 && !current.canShrink) {
if (deltaY > 0 || deltaX > 0) {
F.prev( deltaY > 0 ? 'down' : 'left' );
} else if (deltaY < 0 || deltaX < 0) {
F.next( deltaY < 0 ? 'up' : 'right' );
}
e.preventDefault();
}
}
});
}
},
trigger: function (event, o) {
var ret, obj = o || F.coming || F.current;
if (!obj) {
return;
}
if ($.isFunction( obj[event] )) {
ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
}
if (ret === false) {
return false;
}
if (obj.helpers) {
$.each(obj.helpers, function (helper, opts) {
if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj);
}
});
}
D.trigger(event);
},
isImage: function (str) {
return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
},
isSWF: function (str) {
return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
},
_start: function (index) {
var coming = {},
obj,
href,
type,
margin,
padding;
index = getScalar( index );
obj = F.group[ index ] || null;
if (!obj) {
return false;
}
coming = $.extend(true, {}, F.opts, obj);
// Convert margin and padding properties to array - top, right, bottom, left
margin = coming.margin;
padding = coming.padding;
if ($.type(margin) === 'number') {
coming.margin = [margin, margin, margin, margin];
}
if ($.type(padding) === 'number') {
coming.padding = [padding, padding, padding, padding];
}
// 'modal' propery is just a shortcut
if (coming.modal) {
$.extend(true, coming, {
closeBtn : false,
closeClick : false,
nextClick : false,
arrows : false,
mouseWheel : false,
keys : null,
helpers: {
overlay : {
closeClick : false
}
}
});
}
// 'autoSize' property is a shortcut, too
if (coming.autoSize) {
coming.autoWidth = coming.autoHeight = true;
}
if (coming.width === 'auto') {
coming.autoWidth = true;
}
if (coming.height === 'auto') {
coming.autoHeight = true;
}
/*
* Add reference to the group, so it`s possible to access from callbacks, example:
* afterLoad : function() {
* this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
* }
*/
coming.group = F.group;
coming.index = index;
// Give a chance for callback or helpers to update coming item (type, title, etc)
F.coming = coming;
if (false === F.trigger('beforeLoad')) {
F.coming = null;
return;
}
type = coming.type;
href = coming.href;
if (!type) {
F.coming = null;
//If we can not determine content type then drop silently or display next/prev item if looping through gallery
if (F.current && F.router && F.router !== 'jumpto') {
F.current.index = index;
return F[ F.router ]( F.direction );
}
return false;
}
F.isActive = true;
if (type === 'image' || type === 'swf') {
coming.autoHeight = coming.autoWidth = false;
coming.scrolling = 'visible';
}
if (type === 'image') {
coming.aspectRatio = true;
}
if (type === 'iframe' && isTouch) {
coming.scrolling = 'scroll';
}
// Build the neccessary markup
coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
$.extend(coming, {
skin : $('.fancybox-skin', coming.wrap),
outer : $('.fancybox-outer', coming.wrap),
inner : $('.fancybox-inner', coming.wrap)
});
$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
});
F.trigger('onReady');
// Check before try to load; 'inline' and 'html' types need content, others - href
if (type === 'inline' || type === 'html') {
if (!coming.content || !coming.content.length) {
return F._error( 'content' );
}
} else if (!href) {
return F._error( 'href' );
}
if (type === 'image') {
F._loadImage();
} else if (type === 'ajax') {
F._loadAjax();
} else if (type === 'iframe') {
F._loadIframe();
} else {
F._afterLoad();
}
},
_error: function ( type ) {
$.extend(F.coming, {
type : 'html',
autoWidth : true,
autoHeight : true,
minWidth : 0,
minHeight : 0,
scrolling : 'no',
hasError : type,
content : F.coming.tpl.error
});
F._afterLoad();
},
_loadImage: function () {
// Reset preload image so it is later possible to check "complete" property
var img = F.imgPreload = new Image();
img.onload = function () {
this.onload = this.onerror = null;
F.coming.width = this.width / F.opts.pixelRatio;
F.coming.height = this.height / F.opts.pixelRatio;
F._afterLoad();
};
img.onerror = function () {
this.onload = this.onerror = null;
F._error( 'image' );
};
img.src = F.coming.href;
if (img.complete !== true) {
F.showLoading();
}
},
_loadAjax: function () {
var coming = F.coming;
F.showLoading();
F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
url: coming.href,
error: function (jqXHR, textStatus) {
if (F.coming && textStatus !== 'abort') {
F._error( 'ajax', jqXHR );
} else {
F.hideLoading();
}
},
success: function (data, textStatus) {
if (textStatus === 'success') {
coming.content = data;
F._afterLoad();
}
}
}));
},
_loadIframe: function() {
var coming = F.coming,
iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
.attr('src', coming.href);
// This helps IE
$(coming.wrap).bind('onReset', function () {
try {
$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
} catch (e) {}
});
if (coming.iframe.preload) {
F.showLoading();
iframe.one('load', function() {
$(this).data('ready', 1);
// iOS will lose scrolling if we resize
if (!isTouch) {
$(this).bind('load.fb', F.update);
}
// Without this trick:
// - iframe won't scroll on iOS devices
// - IE7 sometimes displays empty iframe
$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
F._afterLoad();
});
}
coming.content = iframe.appendTo( coming.inner );
if (!coming.iframe.preload) {
F._afterLoad();
}
},
_preloadImages: function() {
var group = F.group,
current = F.current,
len = group.length,
cnt = current.preload ? Math.min(current.preload, len - 1) : 0,
item,
i;
for (i = 1; i <= cnt; i += 1) {
item = group[ (current.index + i ) % len ];
if (item.type === 'image' && item.href) {
new Image().src = item.href;
}
}
},
_afterLoad: function () {
var coming = F.coming,
previous = F.current,
placeholder = 'fancybox-placeholder',
current,
content,
type,
scrolling,
href,
embed;
F.hideLoading();
if (!coming || F.isActive === false) {
return;
}
if (false === F.trigger('afterLoad', coming, previous)) {
coming.wrap.stop(true).trigger('onReset').remove();
F.coming = null;
return;
}
if (previous) {
F.trigger('beforeChange', previous);
previous.wrap.stop(true).removeClass('fancybox-opened')
.find('.fancybox-item, .fancybox-nav')
.remove();
}
F.unbindEvents();
current = coming;
content = coming.content;
type = coming.type;
scrolling = coming.scrolling;
$.extend(F, {
wrap : current.wrap,
skin : current.skin,
outer : current.outer,
inner : current.inner,
current : current,
previous : previous
});
href = current.href;
switch (type) {
case 'inline':
case 'ajax':
case 'html':
if (current.selector) {
content = $('
').html(content).find(current.selector);
} else if (isQuery(content)) {
if (!content.data(placeholder)) {
content.data(placeholder, $('
').insertAfter( content ).hide() );
}
content = content.show().detach();
current.wrap.bind('onReset', function () {
if ($(this).find(content).length) {
content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
}
});
}
break;
case 'image':
content = current.tpl.image.replace('{href}', href);
break;
case 'swf':
content = '
';
embed = '';
$.each(current.swf, function(name, val) {
content += ' ';
embed += ' ' + name + '="' + val + '"';
});
content += '';
break;
}
if (!(isQuery(content) && content.parent().is(current.inner))) {
current.inner.append( content );
}
// Give a chance for helpers or callbacks to update elements
F.trigger('beforeShow');
// Set scrolling before calculating dimensions
current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
// Set initial dimensions and start position
F._setDimension();
F.reposition();
F.isOpen = false;
F.coming = null;
F.bindEvents();
if (!F.isOpened) {
$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
} else if (previous.prevMethod) {
F.transitions[ previous.prevMethod ]();
}
F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
F._preloadImages();
},
_setDimension: function () {
var viewport = F.getViewport(),
steps = 0,
canShrink = false,
canExpand = false,
wrap = F.wrap,
skin = F.skin,
inner = F.inner,
current = F.current,
width = current.width,
height = current.height,
minWidth = current.minWidth,
minHeight = current.minHeight,
maxWidth = current.maxWidth,
maxHeight = current.maxHeight,
scrolling = current.scrolling,
scrollOut = current.scrollOutside ? current.scrollbarWidth : 0,
margin = current.margin,
wMargin = getScalar(margin[1] + margin[3]),
hMargin = getScalar(margin[0] + margin[2]),
wPadding,
hPadding,
wSpace,
hSpace,
origWidth,
origHeight,
origMaxWidth,
origMaxHeight,
ratio,
width_,
height_,
maxWidth_,
maxHeight_,
iframe,
body;
// Reset dimensions so we could re-check actual size
wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
wPadding = getScalar(skin.outerWidth(true) - skin.width());
hPadding = getScalar(skin.outerHeight(true) - skin.height());
// Any space between content and viewport (margin, padding, border, title)
wSpace = wMargin + wPadding;
hSpace = hMargin + hPadding;
origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width;
origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
if (current.type === 'iframe') {
iframe = current.content;
if (current.autoHeight && iframe.data('ready') === 1) {
try {
if (iframe[0].contentWindow.document.location) {
inner.width( origWidth ).height(9999);
body = iframe.contents().find('body');
if (scrollOut) {
body.css('overflow-x', 'hidden');
}
origHeight = body.outerHeight(true);
}
} catch (e) {}
}
} else if (current.autoWidth || current.autoHeight) {
inner.addClass( 'fancybox-tmp' );
// Set width or height in case we need to calculate only one dimension
if (!current.autoWidth) {
inner.width( origWidth );
}
if (!current.autoHeight) {
inner.height( origHeight );
}
if (current.autoWidth) {
origWidth = inner.width();
}
if (current.autoHeight) {
origHeight = inner.height();
}
inner.removeClass( 'fancybox-tmp' );
}
width = getScalar( origWidth );
height = getScalar( origHeight );
ratio = origWidth / origHeight;
// Calculations for the content
minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
// These will be used to determine if wrap can fit in the viewport
origMaxWidth = maxWidth;
origMaxHeight = maxHeight;
if (current.fitToView) {
maxWidth = Math.min(viewport.w - wSpace, maxWidth);
maxHeight = Math.min(viewport.h - hSpace, maxHeight);
}
maxWidth_ = viewport.w - wMargin;
maxHeight_ = viewport.h - hMargin;
if (current.aspectRatio) {
if (width > maxWidth) {
width = maxWidth;
height = getScalar(width / ratio);
}
if (height > maxHeight) {
height = maxHeight;
width = getScalar(height * ratio);
}
if (width < minWidth) {
width = minWidth;
height = getScalar(width / ratio);
}
if (height < minHeight) {
height = minHeight;
width = getScalar(height * ratio);
}
} else {
width = Math.max(minWidth, Math.min(width, maxWidth));
if (current.autoHeight && current.type !== 'iframe') {
inner.width( width );
height = inner.height();
}
height = Math.max(minHeight, Math.min(height, maxHeight));
}
// Try to fit inside viewport (including the title)
if (current.fitToView) {
inner.width( width ).height( height );
wrap.width( width + wPadding );
// Real wrap dimensions
width_ = wrap.width();
height_ = wrap.height();
if (current.aspectRatio) {
while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
if (steps++ > 19) {
break;
}
height = Math.max(minHeight, Math.min(maxHeight, height - 10));
width = getScalar(height * ratio);
if (width < minWidth) {
width = minWidth;
height = getScalar(width / ratio);
}
if (width > maxWidth) {
width = maxWidth;
height = getScalar(width / ratio);
}
inner.width( width ).height( height );
wrap.width( width + wPadding );
width_ = wrap.width();
height_ = wrap.height();
}
} else {
width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_)));
height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
}
}
if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
width += scrollOut;
}
inner.width( width ).height( height );
wrap.width( width + wPadding );
width_ = wrap.width();
height_ = wrap.height();
canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
$.extend(current, {
dim : {
width : getValue( width_ ),
height : getValue( height_ )
},
origWidth : origWidth,
origHeight : origHeight,
canShrink : canShrink,
canExpand : canExpand,
wPadding : wPadding,
hPadding : hPadding,
wrapSpace : height_ - skin.outerHeight(true),
skinSpace : skin.height() - height
});
if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
inner.height('auto');
}
},
_getPosition: function (onlyAbsolute) {
var current = F.current,
viewport = F.getViewport(),
margin = current.margin,
width = F.wrap.width() + margin[1] + margin[3],
height = F.wrap.height() + margin[0] + margin[2],
rez = {
position: 'absolute',
top : margin[0],
left : margin[3]
};
if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
rez.position = 'fixed';
} else if (!current.locked) {
rez.top += viewport.y;
rez.left += viewport.x;
}
rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio)));
rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio)));
return rez;
},
_afterZoomIn: function () {
var current = F.current;
if (!current) {
return;
}
F.isOpen = F.isOpened = true;
F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
F.update();
// Assign a click event
if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
e.preventDefault();
F[ current.closeClick ? 'close' : 'next' ]();
}
});
}
// Create a close button
if (current.closeBtn) {
$(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) {
e.preventDefault();
F.close();
});
}
// Create navigation arrows
if (current.arrows && F.group.length > 1) {
if (current.loop || current.index > 0) {
$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
}
if (current.loop || current.index < F.group.length - 1) {
$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
}
}
F.trigger('afterShow');
// Stop the slideshow if this is the last item
if (!current.loop && current.index === current.group.length - 1) {
F.play( false );
} else if (F.opts.autoPlay && !F.player.isActive) {
F.opts.autoPlay = false;
F.play();
}
},
_afterZoomOut: function ( obj ) {
obj = obj || F.current;
$('.fancybox-wrap').trigger('onReset').remove();
$.extend(F, {
group : {},
opts : {},
router : false,
current : null,
isActive : false,
isOpened : false,
isOpen : false,
isClosing : false,
wrap : null,
skin : null,
outer : null,
inner : null
});
F.trigger('afterClose', obj);
}
});
/*
* Default transitions
*/
F.transitions = {
getOrigPosition: function () {
var current = F.current,
element = current.element,
orig = current.orig,
pos = {},
width = 50,
height = 50,
hPadding = current.hPadding,
wPadding = current.wPadding,
viewport = F.getViewport();
if (!orig && current.isDom && element.is(':visible')) {
orig = element.find('img:first');
if (!orig.length) {
orig = element;
}
}
if (isQuery(orig)) {
pos = orig.offset();
if (orig.is('img')) {
width = orig.outerWidth();
height = orig.outerHeight();
}
} else {
pos.top = viewport.y + (viewport.h - height) * current.topRatio;
pos.left = viewport.x + (viewport.w - width) * current.leftRatio;
}
if (F.wrap.css('position') === 'fixed' || current.locked) {
pos.top -= viewport.y;
pos.left -= viewport.x;
}
pos = {
top : getValue(pos.top - hPadding * current.topRatio),
left : getValue(pos.left - wPadding * current.leftRatio),
width : getValue(width + wPadding),
height : getValue(height + hPadding)
};
return pos;
},
step: function (now, fx) {
var ratio,
padding,
value,
prop = fx.prop,
current = F.current,
wrapSpace = current.wrapSpace,
skinSpace = current.skinSpace;
if (prop === 'width' || prop === 'height') {
ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
if (F.isClosing) {
ratio = 1 - ratio;
}
padding = prop === 'width' ? current.wPadding : current.hPadding;
value = now - padding;
F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) );
F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
}
},
zoomIn: function () {
var current = F.current,
startPos = current.pos,
effect = current.openEffect,
elastic = effect === 'elastic',
endPos = $.extend({opacity : 1}, startPos);
// Remove "position" property that breaks older IE
delete endPos.position;
if (elastic) {
startPos = this.getOrigPosition();
if (current.openOpacity) {
startPos.opacity = 0.1;
}
} else if (effect === 'fade') {
startPos.opacity = 0.1;
}
F.wrap.css(startPos).animate(endPos, {
duration : effect === 'none' ? 0 : current.openSpeed,
easing : current.openEasing,
step : elastic ? this.step : null,
complete : F._afterZoomIn
});
},
zoomOut: function () {
var current = F.current,
effect = current.closeEffect,
elastic = effect === 'elastic',
endPos = {opacity : 0.1};
if (elastic) {
endPos = this.getOrigPosition();
if (current.closeOpacity) {
endPos.opacity = 0.1;
}
}
F.wrap.animate(endPos, {
duration : effect === 'none' ? 0 : current.closeSpeed,
easing : current.closeEasing,
step : elastic ? this.step : null,
complete : F._afterZoomOut
});
},
changeIn: function () {
var current = F.current,
effect = current.nextEffect,
startPos = current.pos,
endPos = { opacity : 1 },
direction = F.direction,
distance = 200,
field;
startPos.opacity = 0.1;
if (effect === 'elastic') {
field = direction === 'down' || direction === 'up' ? 'top' : 'left';
if (direction === 'down' || direction === 'right') {
startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
endPos[ field ] = '+=' + distance + 'px';
} else {
startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
endPos[ field ] = '-=' + distance + 'px';
}
}
// Workaround for http://bugs.jquery.com/ticket/12273
if (effect === 'none') {
F._afterZoomIn();
} else {
F.wrap.css(startPos).animate(endPos, {
duration : current.nextSpeed,
easing : current.nextEasing,
complete : F._afterZoomIn
});
}
},
changeOut: function () {
var previous = F.previous,
effect = previous.prevEffect,
endPos = { opacity : 0.1 },
direction = F.direction,
distance = 200;
if (effect === 'elastic') {
endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
}
previous.wrap.animate(endPos, {
duration : effect === 'none' ? 0 : previous.prevSpeed,
easing : previous.prevEasing,
complete : function () {
$(this).trigger('onReset').remove();
}
});
}
};
/*
* Overlay helper
*/
F.helpers.overlay = {
defaults : {
closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay
speedOut : 200, // duration of fadeOut animation
showEarly : true, // indicates if should be opened immediately or wait until the content is ready
css : {}, // custom CSS properties
locked : !isTouch, // if true, the content will be locked into overlay
fixed : true // if false, the overlay CSS position property will not be set to "fixed"
},
overlay : null, // current handle
fixed : false, // indicates if the overlay has position "fixed"
el : $('html'), // element that contains "the lock"
// Public methods
create : function(opts) {
opts = $.extend({}, this.defaults, opts);
if (this.overlay) {
this.close();
}
this.overlay = $('
').appendTo( F.coming ? F.coming.parent : opts.parent );
this.fixed = false;
if (opts.fixed && F.defaults.fixed) {
this.overlay.addClass('fancybox-overlay-fixed');
this.fixed = true;
}
},
open : function(opts) {
var that = this;
opts = $.extend({}, this.defaults, opts);
if (this.overlay) {
this.overlay.unbind('.overlay').width('auto').height('auto');
} else {
this.create(opts);
}
if (!this.fixed) {
W.bind('resize.overlay', $.proxy( this.update, this) );
this.update();
}
if (opts.closeClick) {
this.overlay.bind('click.overlay', function(e) {
if ($(e.target).hasClass('fancybox-overlay')) {
if (F.isActive) {
F.close();
} else {
that.close();
}
return false;
}
});
}
this.overlay.css( opts.css ).show();
},
close : function() {
var scrollV, scrollH;
W.unbind('resize.overlay');
if (this.el.hasClass('fancybox-lock')) {
$('.fancybox-margin').removeClass('fancybox-margin');
scrollV = W.scrollTop();
scrollH = W.scrollLeft();
this.el.removeClass('fancybox-lock');
W.scrollTop( scrollV ).scrollLeft( scrollH );
}
$('.fancybox-overlay').remove().hide();
$.extend(this, {
overlay : null,
fixed : false
});
},
// Private, callbacks
update : function () {
var width = '100%', offsetWidth;
// Reset width/height so it will not mess
this.overlay.width(width).height('100%');
// jQuery does not return reliable result for IE
if (IE) {
offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
if (D.width() > offsetWidth) {
width = D.width();
}
} else if (D.width() > W.width()) {
width = D.width();
}
this.overlay.width(width).height(D.height());
},
// This is where we can manipulate DOM, because later it would cause iframes to reload
onReady : function (opts, obj) {
var overlay = this.overlay;
$('.fancybox-overlay').stop(true, true);
if (!overlay) {
this.create(opts);
}
if (opts.locked && this.fixed && obj.fixed) {
if (!overlay) {
this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false;
}
obj.locked = this.overlay.append( obj.wrap );
obj.fixed = false;
}
if (opts.showEarly === true) {
this.beforeShow.apply(this, arguments);
}
},
beforeShow : function(opts, obj) {
var scrollV, scrollH;
if (obj.locked) {
if (this.margin !== false) {
$('*').filter(function(){
return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
}).addClass('fancybox-margin');
this.el.addClass('fancybox-margin');
}
scrollV = W.scrollTop();
scrollH = W.scrollLeft();
this.el.addClass('fancybox-lock');
W.scrollTop( scrollV ).scrollLeft( scrollH );
}
this.open(opts);
},
onUpdate : function() {
if (!this.fixed) {
this.update();
}
},
afterClose: function (opts) {
// Remove overlay if exists and fancyBox is not opening
// (e.g., it is not being open using afterClose callback)
//if (this.overlay && !F.isActive) {
if (this.overlay && !F.coming) {
this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
}
}
};
/*
* Title helper
*/
F.helpers.title = {
defaults : {
type : 'float', // 'float', 'inside', 'outside' or 'over',
position : 'bottom' // 'top' or 'bottom'
},
beforeShow: function (opts) {
var current = F.current,
text = current.title,
type = opts.type,
title,
target;
if ($.isFunction(text)) {
text = text.call(current.element, current);
}
if (!isString(text) || $.trim(text) === '') {
return;
}
title = $('
' + text + '
');
switch (type) {
case 'inside':
target = F.skin;
break;
case 'outside':
target = F.wrap;
break;
case 'over':
target = F.inner;
break;
default: // 'float'
target = F.skin;
title.appendTo('body');
if (IE) {
title.width( title.width() );
}
title.wrapInner('
');
//Increase bottom margin so this title will also fit into viewport
F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
break;
}
title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target);
}
};
// jQuery plugin initialization
$.fn.fancybox = function (options) {
var index,
that = $(this),
selector = this.selector || '',
run = function(e) {
var what = $(this).blur(), idx = index, relType, relVal;
if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
relType = options.groupAttr || 'data-fancybox-group';
relVal = what.attr(relType);
if (!relVal) {
relType = 'rel';
relVal = what.get(0)[ relType ];
}
if (relVal && relVal !== '' && relVal !== 'nofollow') {
what = selector.length ? $(selector) : that;
what = what.filter('[' + relType + '="' + relVal + '"]');
idx = what.index(this);
}
options.index = idx;
// Stop an event from bubbling if everything is fine
if (F.open(what, options) !== false) {
e.preventDefault();
}
}
};
options = options || {};
index = options.index || 0;
if (!selector || options.live === false) {
that.unbind('click.fb-start').bind('click.fb-start', run);
} else {
D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
}
this.filter('[data-fancybox-start=1]').trigger('click');
return this;
};
// Tests that need a body at doc ready
D.ready(function() {
var w1, w2;
if ( $.scrollbarWidth === undefined ) {
// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
$.scrollbarWidth = function() {
var parent = $('
').appendTo('body'),
child = parent.children(),
width = child.innerWidth() - child.height( 99 ).innerWidth();
parent.remove();
return width;
};
}
if ( $.support.fixedPosition === undefined ) {
$.support.fixedPosition = (function() {
var elem = $('
').appendTo('body'),
fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
elem.remove();
return fixed;
}());
}
$.extend(F.defaults, {
scrollbarWidth : $.scrollbarWidth(),
fixed : $.support.fixedPosition,
parent : $('body')
});
//Get real width of page scroll-bar
w1 = $(window).width();
H.addClass('fancybox-lock-test');
w2 = $(window).width();
H.removeClass('fancybox-lock-test');
$("").appendTo("head");
});
}(window, document, jQuery));
/* ---------------------UUUUUUUUUUUUU---------------------------------- */