").addClass("tpd-close-icon").html("×")))))),this.skin=new Skin(this),this._contentSpacer.css({"border-radius":Math.max(this.skin._css.radius-this.skin._css.border,0)}),this.createPostBuildObservers(),this.is("build",!0))},createPostBuildObservers:function(){this._tooltip.delegate(".tpd-close, .close-tooltip","click",function(t){t.stopPropagation(),t.preventDefault(),this.is("api",!1),this.hide(!0)}.bind(this))},createPreBuildObservers:function(){this.bind(this.element,"mouseenter",this.setActive),this.bind(this._tooltip,Support.touch&&Browser.MobileSafari?"touchstart":"mouseenter",this.setActive),this.bind(this.element,"mouseleave",function(t){this.setIdle(t)}),this.bind(this._tooltip,"mouseleave",function(t){this.setIdle(t)}),this.options.showOn&&($.each(this.options.showOn,function(t,i){var e,s=!1;switch(t){case"element":e=this.element,this.options.hideOn&&this.options.showOn&&"click"===this.options.hideOn.element&&"click"===this.options.showOn.element&&this.is("toggleable",s=!0);break;case"tooltip":e=this._tooltip;break;case"target":e=this.target}e&&i&&this.bind(e,i,"click"===i&&s?function(){this.is("api",!1),this.toggle()}:function(){this.is("api",!1),this.showDelayed()})}.bind(this)),Support.touch&&Browser.MobileSafari&&this.bind(this._tooltip,"touchend",function(){this._tooltipTouchEndTime=(new Date).getTime()})),this.options.hideOn&&$.each(this.options.hideOn,function(t,i){var e,s;switch(t){case"element":if(this.is("toggleable")&&"click"===i)return;e=this.element;break;case"tooltip":e=this._tooltip;break;case"target":e=this.target}e&&i&&(s=i,Support.touch&&Browser.MobileSafari&&/^(target|element)/.test(t)&&/mouse(leave|out)/.test(s)?this.bind(e,s,function(t){if(this._tooltipTouchEndTime&&/^mouse(leave|out)$/.test(t.type)&&(new Date).getTime()-this._tooltipTouchEndTime<450)return;this.is("api",!1),this.hideDelayed()}):this.bind(e,s,function(){this.is("api",!1),this.hideDelayed()}))}.bind(this)),this.options.hideOnClickOutside&&($(this.element).addClass("tpd-hideOnClickOutside"),this.bind(document.documentElement,"click touchend",function(t){this.visible()&&((t=$(t.target).closest(".tpd-tooltip, .tpd-hideOnClickOutside")[0])&&(t===this._tooltip[0]||t===this.element)||this.hide())}.bind(this))),"mouse"===this.options.target&&this.bind(this.element,"mouseenter mousemove",function(t){this._cache.event=t}.bind(this));var t=!1;(t=this.options.showOn&&"mouse"===this.options.target&&!this.options.fixed?!0:t)&&this.bind(this.element,"mousemove",function(){this.is("build")&&(this.is("api",!1),this.position())})}}),$.extend(Tooltip.prototype,{stop:function(){this._tooltip&&(this.queues.showhide.queue([]),this._tooltip.stop(1,0))},showDelayed:function(t){this.is("disabled")||(this.clearTimer("hide"),this.is("visible")||this.getTimer("show")||this.setTimer("show",function(){this.clearTimer("show"),this.show()}.bind(this),this.options.showDelay||1))},show:function(){var t;this.clearTimer("hide"),this.visible()||this.is("disabled")||!$(this.target).is(":visible")||(this.is("visible",!0),this.attach(),this.stop(),t=this.queues.showhide,this.is("updated")||this.is("updating")||t.queue(function(i){this._onResizeDimensions={width:0,height:0},this.update(function(t){if(t)return this.is("visible",!1),void this.detach();i()}.bind(this))}.bind(this)),t.queue(function(t){this.is("sanitized")?(this.stopLoading(),this._contentWrapper.css({visibility:"visible"}),this.is("resize-to-content",!0),t()):(this._contentWrapper.css({visibility:"hidden"}),this.startLoading(),this.sanitize(function(){this.stopLoading(),this._contentWrapper.css({visibility:"visible"}),this.is("resize-to-content",!0),t()}.bind(this)))}.bind(this)),t.queue(function(t){this.position(),this.raise(),t()}.bind(this)),t.queue(function(t){var i;this.is("updated")&&"function"==typeof this.options.onShow&&(i=new Visible(this._tooltip),this.options.onShow(this._content[0],this.element),i.restore()),t()}.bind(this)),t.queue(function(t){this._show(this.options.fadeIn,function(){t()})}.bind(this)))},_show:function(t,i){t=("number"==typeof t?t:this.options.fadeIn)||0,i=i||"function"==typeof arguments[0]&&arguments[0],this.options.hideOthers&&Tooltips.hideAll(this),this._tooltip.fadeTo(t,1,function(){i&&i()}.bind(this))},hideDelayed:function(){this.clearTimer("show"),this.getTimer("hide")||!this.visible()||this.is("disabled")||this.setTimer("hide",function(){this.clearTimer("hide"),this.hide()}.bind(this),this.options.hideDelay||1)},hide:function(i,e){var t;this.clearTimer("show"),this.visible()&&!this.is("disabled")&&(this.is("visible",!1),this.stop(),(t=this.queues.showhide).queue(function(t){this.abort(),t()}.bind(this)),t.queue(function(t){this._hide(i,t)}.bind(this)),t.queue(function(t){Tooltips.resetZ(),t()}),t.queue(function(t){this.clearUpdatedTo(),t()}.bind(this)),"function"==typeof this.options.afterHide&&this.is("updated")&&t.queue(function(t){this.options.afterHide(this._content[0],this.element),t()}.bind(this)),this.options.cache||!this.options.ajax&&!this._fn||t.queue(function(t){this.is("updated",!1),this.is("updating",!1),this.is("sanitized",!1),t()}.bind(this)),"function"==typeof e&&t.queue(function(t){e(),t()}),t.queue(function(t){this.detach(),t()}.bind(this)))},_hide:function(t,i){i=i||"function"==typeof t&&t,this.attach(),this._tooltip.fadeTo(t?0:this.options.fadeOut,0,function(){this.stopLoading(),this.is("resize-to-content",!1),this._tooltip.hide(),i&&i()}.bind(this))},toggle:function(){this.is("disabled")||this[this.visible()?"hide":"show"]()},raise:function(){var t;!this.is("build")||this.options.zIndex||(t=Tooltips.getHighestTooltip())&&t!==this&&this.zIndex<=t.zIndex&&(this.zIndex=t.zIndex+1,this._tooltip.css({"z-index":this.zIndex}),this._tooltipShadow&&(this._tooltipShadow.css({"z-index":this.zIndex}),this.zIndex=t.zIndex+2,this._tooltip.css({"z-index":this.zIndex})))}}),$.extend(Tooltip.prototype,{createElementMarker:function(){!this.elementMarker&&this.content&&_.element.isAttached(this.content)&&($(this.content).data("tpd-restore-inline-display",$(this.content).css("display")),this.elementMarker=$("
").hide(),$(this.content).before($(this.elementMarker).hide()))},restoreElementToMarker:function(){var t;this.elementMarker&&this.content&&((t=$(this.content).data("tpd-restore-inline-display"))&&$(this.content).css({display:t}),$(this.elementMarker).before(this.content).remove())},startLoading:function(){this.is("loading")||(this.build(),this.is("loading",!0),this.options.spinner&&(this._tooltip.addClass("tpd-is-loading"),this.skin.startLoading(),this.is("resize-to-content")||(this.position(),this.raise(),this._show())))},stopLoading:function(){this.build(),this.is("loading",!1),this.options.spinner&&(this._tooltip.removeClass("tpd-is-loading"),this.skin.stopLoading())},abort:function(){this.abortAjax(),this.abortSanitize(),this.is("refreshed-before-sanitized",!1)},abortSanitize:function(){this._cache.voila&&(this._cache.voila.abort(),this._cache.voila=null)},abortAjax:function(){this._cache.xhr&&(this._cache.xhr.abort(),this._cache.xhr=null,this.is("updated",!1),this.is("updating",!1))},update:function(o){if(!this.is("updating")){this.is("updating",!0),this.build();var t=this.options.inline?"inline":this.options.ajax?"ajax":_.isElement(this.content)||_.isText(this.content)||_.isDocumentFragment(this.content)?"element":this._fn?"function":"html";switch(this._contentWrapper.css({visibility:"hidden"}),t){case"html":case"element":case"inline":if(this.is("updated"))return void(o&&o());this._update(this.content,o);break;case"function":if(this.is("updated"))return void(o&&o());var i=this._fn(this.element);if(!i)return this.is("updating",!1),void(o&&o(!0));this._update(i,o);break;case"ajax":var e=this.options.ajax||{},s=e.url||this.__content,n=e.data||{},t=e.type||"GET",i=e.dataType,n={url:s,data:n};t&&$.extend(n,{type:t}),i&&$.extend(n,{dataType:i});var h,r=$.extend({},n,e);if(r.method&&delete(r=$.extend({},r)).method,$.each("complete error success".split(" "),function(t,s){r[s]||(r[s]="success"===s?function(t,i,e){return e.responseText}:function(){}),r[s]=_.wrap(r[s],function(t){var i=_slice.call(arguments,1),e="object"==typeof i[0]?i[0]:i[2];e.statusText&&"abort"===e.statusText||(this.options.cache&&AjaxCache.set({url:r.url,type:r.type,data:r.data},s,i),this._cache.xhr=null,(i=t.apply(this,i))&&this._update(i,o))}.bind(this))}.bind(this)),this.options.cache&&(h=AjaxCache.get(r))&&h.callbacks.success)return void $.each(h.callbacks,function(t,i){"function"==typeof r[t]&&r[t].apply(this,i)}.bind(this));this.startLoading(),this._cache.xhr=$.ajax(r)}}},_update:function(t,i){var e={title:this.options.title,close:this.options.close};"string"==typeof t||_.isElement(t)||_.isText(t)||_.isDocumentFragment(t)||t instanceof $?e.content=t:$.extend(e,t);var t=e.content,s=e.title,e=e.close;this.content=t,this.title=s,this.close=e,this.createElementMarker(),(_.isElement(t)||t instanceof $)&&$(t).show(),this._content.html(this.content),this._title.html(s&&"string"==typeof s?s:""),this._titleWrapper[s?"show":"hide"](),this._close[(this.title||this.options.title)&&e?"show":"hide"]();t=e&&!(this.options.title||this.title),s=e&&!(this.options.title||this.title)&&"overlap"!==e,e=e&&(this.options.title||this.title)&&"overlap"!==e;this._inner_close[t?"show":"hide"](),this._tooltip[(s?"add":"remove")+"Class"]("tpd-has-inner-close"),this._tooltip[(e?"add":"remove")+"Class"]("tpd-has-title-close"),this._content[(this.options.padding?"remove":"add")+"Class"]("tpd-content-no-padding"),this.finishUpdate(i)},sanitize:function(i){if(!this.options.voila||this._content.find("img").length<1)return this.is("sanitized",!0),void(i&&i());this._cache.voila=Voila(this._content,{method:"onload"},function(t){this._markImagesAsSanitized(t.images),this.is("refreshed-before-sanitized")?(this.is("refreshed-before-sanitized",!1),this.sanitize(i)):(this.is("sanitized",!0),i&&i())}.bind(this))},_markImagesAsSanitized:function(t){$.each(t,function(t,i){var e=i.img;$(e).data("completed-src",i.img.src)})},_hasAllImagesSanitized:function(){var s=!0;return this._content.find("img").each(function(t,i){var e=$(i).data("completed-src");if(!e||i.src!==e)return s=!1}),s},refresh:function(){this.visible()&&(this.is("sanitized")?(this.is("refreshing",!0),this.clearTimer("refresh-spinner"),!this.options.voila||this._content.find("img").length<1||this._hasAllImagesSanitized()?(this.is("should-update-dimensions",!0),this.position(),this.is("refreshing",!1)):(this.is("sanitized",!1),this._contentWrapper.css({visibility:"hidden"}),this.startLoading(),this.sanitize(function(){this._contentWrapper.css({visibility:"visible"}),this.stopLoading(),this.is("should-update-dimensions",!0),this.position(),this.is("refreshing",!1)}.bind(this)))):this.is("refreshed-before-sanitized",!0))},finishUpdate:function(t){var i;this.is("updated",!0),this.is("updating",!1),"function"==typeof this.options.afterUpdate&&((i=this._contentWrapper.css("visibility"))&&this._contentWrapper.css({visibility:"visible"}),this.options.afterUpdate(this._content[0],this.element),i&&this._contentWrapper.css({visibility:"hidden"})),t&&t()}}),$.extend(Tooltip.prototype,{clearUpdatedTo:function(){this._cache.updatedTo={}},updateDimensionsToContent:function(t,i){this.skin.build();var e,s,o,n,h,r,a,d,l,p,c,u,f,m=this.is("loading"),g=this._cache.updatedTo;(this._maxWidthPass||this.is("api")||this.is("should-update-dimensions")||g.stemPosition!==i||g.loading!==m)&&(m&&this.is("resize-to-content")||(this._cache.updatedTo={type:this.is("resize-to-content")?"content":"spinner",loading:this.is("loading"),stemPosition:i},this.is("should-update-dimensions")&&this.is("should-update-dimensions",!1),t=t||this.options.position.target,i=i||this.options.position.tooltip,c=Position.getSide(i),p=Position.getOrientation(i),u=this.skin._css.border,this._tooltip.addClass("tpd-tooltip-measuring"),f=this._tooltip.attr("style"),this._tooltip.removeAttr("style"),e={top:u,right:u,bottom:u,left:u},h=0,"vertical"===Position.getOrientation(i)&&(this.options.stem&&(e[c]=this.skin["stem_"+c].getMath().dimensions.outside.height),(d=this.getMouseRoom())[Position._flip[c]]&&(e[c]+=d[Position._flip[c]]),s=this.getContainmentLayout(i),o=this.getPaddingLine(t),n=!1,Position.isPointWithinBoxLayout(o.x1,o.y1,s)||Position.isPointWithinBoxLayout(o.x2,o.y2,s)?n=!0:$.each("top right bottom left".split(" "),function(t,i){i=this.getSideLine(s,i);if(Position.intersectsLine(o.x1,o.y1,o.x2,o.y2,i.x1,i.y1,i.x2,i.y2))return!(n=!0)}.bind(this)),n&&(h="left"===c?o.x1-s.position.left:s.position.left+s.dimensions.width-o.x1,e[c]+=h)),this.options.offset&&("vertical"!==p||0!==(l=Position.adjustOffsetBasedOnPosition(this.options.offset,this.options.position.target,t)).x&&(e.right+=Math.abs(l.x))),this.options.containment&&(h=this.options.containment.padding)&&($.each(e,function(t,i){e[t]+=h}),"vertical"===p?e["left"===c?"left":"right"]-=h:e["top"===c?"top":"bottom"]-=h),r=Bounds.viewport(),a={width:0,height:0},this.close&&"overlap"!==this.close&&!this.title&&(a=this._innerCloseDimensions||{width:this._inner_close.outerWidth(!0),height:this._inner_close.outerHeight(!0)},this._innerCloseDimensions=a),this._contentRelativePadder.css({"padding-right":a.width}),this._contentSpacer.css({width:r.width-e.left-e.right}),g={width:this._content.innerWidth()+a.width,height:Math.max(this._content.innerHeight(),a.height||0)},m={width:0,height:0},this.title&&(d={width:0,height:0},this._titleWrapper.add(this._titleSpacer).css({width:"auto",height:"auto"}),this.close&&"overlap"!==this.close&&(d={width:this._close.outerWidth(!0),height:this._close.outerHeight(!0)},this._close.hide()),this._maxWidthPass&&g.width>this.options.maxWidth&&this._titleRelative.css({width:g.width}),this._titleRelativePadder.css({"padding-right":d.width}),l=parseFloat(this._titleWrapper.css("border-bottom-width")),(m={width:this.title?this._titleWrapper.innerWidth():0,height:Math.max(this.title?this._titleWrapper.innerHeight()+l:0,d.height+l)}).width>r.width-e.left-e.right&&(m.width=r.width-e.left-e.right,this._titleSpacer.css({width:m.width}),m.height=Math.max(this.title?this._titleWrapper.innerHeight()+l:0,d.height+l)),g.width=Math.max(m.width,g.width),g.height+=m.height,this._titleWrapper.css({height:Math.max(this.title?this._titleWrapper.innerHeight():0,d.height)}),this.close&&this._close.show()),this.options.stem&&(p="vertical"===p?"height":"width",c=this.skin["stem_"+c].getMath().outside.width+2*this.skin._css.radius,g[p]
this.options.maxWidth&&!this._maxWidthPass&&this.is("resize-to-content")&&(f.css({width:this.options.maxWidth}),this._maxWidthPass=!0,this.updateDimensionsToContent(t,i),this._maxWidthPass=!1,f.css({width:"auto"}))))},setDimensions:function(t){this.skin.setDimensions(t)},getContainmentSpace:function(t,i){var e=this.getContainmentLayout(t,i),s=this.getTargetLayout(),o=s.position,t=s.dimensions,i=e.position,s=e.dimensions,e={top:Math.max(o.top-i.top,0),bottom:Math.max(i.top+s.height-(o.top+t.height),0),left:Math.max(o.left-i.left,0),right:Math.max(i.left+s.width-(o.left+t.width),0)};return o.top>i.top+s.height&&(e.top-=o.top-(i.top+s.height)),o.top+t.heighti.left+s.width&&i.left+s.width>=o.left&&(e.left-=o.left-(i.left+s.width)),o.left+t.widthn[h[1]]?0:1])+Position.split(r)[1],c=Position.flip(p=r),o[Position.getSide(p)]?(this.updateDimensionsToContent(p,c),i=this.getPositionBasedOnTarget(p,c)):i.contained=!1,i.contained?this.setPosition(i,c):(e.unshift({position:i,targetPosition:p,stemPosition:c}),d=[],$.each(e,function(t,i){var e,s;0<=i.position.top&&0<=i.position.left?a=i:(e=0<=i.position.top?1:Math.abs(i.position.top),s=0<=i.position.left?1:Math.abs(i.position.left),d.push({result:i,negativity:e*s}))}),a||(l=d[d.length-1],$.each(d,function(t,i){i.negativity=g?(c[w]+=f,l[u]=-1*f,d=!0):Position.getOrientation(t)===Position.getOrientation(i)&&(c[w]+=r*b,l[u]=r*b*-1,c[w]=h.connections[i].move[p[0]]&&_<=h.connections[i].move[p[1]]&&(l[u]-=v)),p=(a=this.getContainment({top:c.top,left:c.left},i)).correction[u],v=deepExtend({},c),this.options.offset&&(v.left-=this.options.offset.x,v.top-=this.options.offset.y),(x={stem:{top:v.top+c.stem.connection.top,left:v.left+c.stem.connection.left}}).stem[w]+=l[u],w=this.getTargetLayout(),y=h.stemDimensions.width,y=Math.floor(.5*y),T=g+m.dimensions[T?"width":"height"],"x"==u?(k=w.position.left+y,0=k&&v.left+p>=g||0
=k&&v.top+p>=g||0
e.position.left+e.dimensions.width)&&(s.horizontal=!1,t.lefte.position.top+e.dimensions.height)&&(s.vertical=!1,t.topg?h=10*d:e>=h&&e!==g?c.maskDigitPosMapOld[h]||(e=h,h=h-(k-l)-a,c.maskDigitPosMap[h]&&(h=e)):h>e&&(h=h+(l-k)+f)}return h},behaviour:function(d){d=
d||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,l.byPassKeys)){e=c.getMasked();var h=c.getCaret(),g=b.data("mask-previus-value")||"";setTimeout(function(){c.setCaret(c.calculateCaretPosition(g))},a.jMaskGlobals.keyStrokeCompensation);c.val(e);c.setCaret(h);return c.callbacks(d)}},getMasked:function(a,b){var h=[],f=void 0===b?c.val():b+"",g=0,k=d.length,n=0,p=f.length,m=1,r="push",u=-1,w=0;b=[];if(e.reverse){r="unshift";m=-1;var x=0;g=k-1;n=p-1;var A=function(){return-1<
g&&-1',file_icon:' ',progress_color:'#4a90e2',time_show_errors:5,layout:'thumbnails',method:'normal',chunk_size:1000000,concurrent_uploads:5,show_percentage:!0,url:'ajax_upload.php',delete_url:'ajax_delete.php',submission_id:''},options);this.each(function(i,val){var v=val;var file_accept=$(v).attr("accept");var file_multiple=$(v).prop("multiple");var file_multiple_count=parseInt($(v).data("count"));var input_name=$(v).prop("name");var max_file_size=0;var uploader_id='drop_uploader_'+i;var added_files=0;var files_index=0;var cf7du_currently_uploading=0;var cur_form=$(v).parent("form");var input_max_file_size=$(cur_form).find("input[name=MAX_FILE_SIZE]").val();if(input_max_file_size!==undefined){max_file_size=parseInt(input_max_file_size)}
var data_max_file_size=$(v).data("maxfilesize");if(data_max_file_size!==undefined){max_file_size=parseInt(data_max_file_size)}
var layout=options.layout;if($(v).data("layout")=="thumbnails"){layout="thumbnails"}else if($(v).data("layout")=="list"){layout="list"}
var submit_method=options.method;if($(v).data("method")=="normal"){submit_method="normal"}else if($(v).data("method")=="ajax"){submit_method="ajax"}else if($(v).data("method")=="chunked"){submit_method="chunked"}
var submit_url=options.url;if($(v).data("url")!=""&&$(v).data("url")!==undefined){submit_url=$(v).data("url")}
var delete_url=options.delete_url;if($(v).data("deleteurl")!=""&&$(v).data("deleteurl")!==undefined){delete_url=$(v).data("deleteurl")}
$(v).attr('id',get_random_id());$(v).wrap('
');$(v).before(''+options.uploader_icon+'
'+options.uploader_text+' '+options.browse_text+' ');$(v).before(' ');$(v).before(' ');if(submit_method=="ajax"||submit_method=="chunked"){$(v).attr('name','')}
var ul_classes="files";if(layout=="thumbnails"){ul_classes+=" thumb"}
if(submit_method=="ajax"){ul_classes+=" ajax"}
if(submit_method=="chunked"){ul_classes+=" ajax"}
$(v).before('');var drop_zone=$('#'+uploader_id);drop_zone[0].ondragover=function(event){drop_zone.addClass('hover');if(submit_method=="normal"){maximizeInput(v);return!1}else if(submit_method=="ajax"||submit_method=="chunked"){minimizeInput(v);return!1}};drop_zone[0].ondragleave=function(event){drop_zone.removeClass('hover');return!1};drop_zone[0].ondrop=function(event){minimizeInput(v);clear_error();if(submit_method=="normal"){var files=event.dataTransfer.files;var check_result=check_files(files);if(check_result==!1){$('#'+uploader_id+' .files').html('');var new_id=get_random_id();var cur_input_html=$(v)[0].outerHTML;var new_v=$.parseHTML(cur_input_html);$(new_v).attr('id',new_id);$(v).before(new_v);$(v).remove();v=$('#'+new_id)[0];$(v).change(function(){files_added()});event.preventDefault?event.preventDefault():(event.returnValue=!1)}}else if(submit_method=="ajax"||submit_method=="chunked"){event.preventDefault?event.preventDefault():(event.returnValue=!1);var files=event.dataTransfer.files;var check_result=check_files(files);if(check_result){files_added(files)}}};$(drop_zone).find("."+options.browse_css_selector).on("click",function(event){event.preventDefault?event.preventDefault():(event.returnValue=!1);$(v).trigger("click")});$(document).on('wpcf7mailsent',function(){$('#'+uploader_id).removeClass('hover');$('#'+uploader_id+' ul.files').html('');$('#'+uploader_id+' input[type=hidden]').each(function(index){if(jQuery(this).attr('name')!='cf7du_submission_id'){jQuery(this).remove()}});var new_id=get_random_id();var cur_input_html=$(v)[0].outerHTML;var new_v=$.parseHTML(cur_input_html);$(new_v).attr('id',new_id);$(v).before(new_v);$(v).remove();v=$('#'+new_id)[0];$(v).change(function(){files_added()});added_files=0});$(v).change(function(){var files=$(v)[0].files;var check_result=check_files(files);if(submit_method=="normal"){if(check_result==!1){$('#'+uploader_id+' .files').html('');var new_id=get_random_id();var cur_input_html=$(v)[0].outerHTML;var new_v=$.parseHTML(cur_input_html);$(new_v).attr('id',new_id);$(v).before(new_v);$(v).remove();v=$('#'+new_id)[0];$(v).change(function(){files_added()});event.preventDefault?event.preventDefault():(event.returnValue=!1)}else{files_added(files)}}else if(submit_method=="ajax"||submit_method=="chunked"){if(check_result){files_added(files)}}});function files_added(files){if(files===undefined){var files=$(v)[0].files}
if(submit_method=="normal"){$('#'+uploader_id+' .files').html('')}
for(var i=0;i
'+files[i].name+' ');preview_file(files[i],files_index)}else{$('#'+uploader_id+' .files').append(''+options.file_icon+' '+files[i].name+' ')}
if(submit_method=="ajax"){file_upload_ajax(files[i],files_index)}else if(submit_method=="chunked"){file_upload_chunked(files[i],files_index)}
files_index++;if(submit_method=="ajax"||submit_method=="chunked"){added_files++}}}
function preview_file(file,i){var reader=new FileReader();getOrientation(file,function(orientation){var rotate_class="";if(orientation==8){rotate_class="rotate_90"}else if(orientation==3){rotate_class="rotate_180"}else if(orientation==6){rotate_class="rotate_270"}
$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').addClass(rotate_class)});if(file.type.match('image/*')){reader.readAsDataURL(file)}
reader.onloadend=function(e){var img=new Image();img.src=reader.result;img.onload=function(){var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);var MAX_WIDTH=200;var MAX_HEIGHT=200;var width=img.width;var height=img.height;if(width>height){if(width>MAX_WIDTH){height*=MAX_WIDTH/width;width=MAX_WIDTH}}else{if(height>MAX_HEIGHT){width*=MAX_HEIGHT/height;height=MAX_HEIGHT}}
canvas.width=width;canvas.height=height;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0,width,height);var dataurl=canvas.toDataURL(file.type);$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').attr('style','background-image: url("'+reader.result+'")');$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append('
')}}}
function file_upload_ajax(file,i){if(cf7du_currently_uploading>=options.concurrent_uploads){setTimeout(file_upload_ajax,5000,file,i);return}
cf7du_currently_uploading++;$('#'+uploader_id).trigger("file_upload_start",[file.name]);var xhr=new XMLHttpRequest();if(layout=="thumbnails"){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').after('
');if(options.show_percentage){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append('
')}}else{$('#'+uploader_id+' #selected_file_'+i).append('
');if(options.show_percentage){$('#'+uploader_id+' #selected_file_'+i).append('
')}}
var progress_el=$('#'+uploader_id+' #selected_file_'+i+' .du_progress');var percent_el=$('#'+uploader_id+' #selected_file_'+i+' .percent');(xhr.upload||xhr).addEventListener('progress',function(e){var done=e.position||e.loaded
var total=e.totalSize||e.total;var progress=Math.round(done/total*100);percent_el.html(Math.round(progress)+'%');draw_round_progress(progress_el[0],progress/100,layout)});xhr.addEventListener('load',function(e){var response=JSON.parse(this.response);$('#'+uploader_id+' #selected_file_'+i+' .du_progress').fadeOut('slow');if(response.success){$('#'+uploader_id).trigger("file_upload_end",[file.name]);$('#'+uploader_id+' #selected_file_'+i+' div.percent').fadeOut("slow");if(file.type.match('image/*')){}else if(file.type.match('video/*')){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append(' ');$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail i').hide().delay(500).fadeIn("slow")}else if(file.type.match('audio/*')){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append(' ');$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail i').hide().delay(500).fadeIn("slow")}else{$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append(' ');$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail i').hide().delay(500).fadeIn("slow")}
var du_delete_button=$(' ').hide();if(layout=="thumbnails"){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append(du_delete_button)}else if(layout=="list"){$('#'+uploader_id+' #selected_file_'+i).append(du_delete_button)}
du_delete_button.delay(500).fadeIn("slow");$('#'+uploader_id).append(' ');$('#'+uploader_id+' #selected_file_'+i+' i.action-delete').on("click",function(event){var fileid=$(this).data("fileid");$.ajax({url:delete_url,data:"fileid="+fileid+"&action=cf7du_upload_file",}).done(function(){$('#'+uploader_id+' #selected_file_'+i).delay(500).fadeOut("slow");$('#'+uploader_id+' #hidden_file_'+i).remove();added_files--})});cf7du_currently_uploading--}else{set_error(response.message);remove_file(i)}});xhr.open('post',submit_url,!0);var fdata=new FormData;fdata.append(input_name.replace('[]',''),file);fdata.append('action','cf7du_upload_file');xhr.send(fdata)}
function file_upload_chunked(file,i){if(cf7du_currently_uploading>=options.concurrent_uploads){setTimeout(file_upload_chunked,5000,file,i);return}
$('#'+uploader_id).trigger("file_upload_start",[file.name]);$('#'+uploader_id).closest("form").find(".wpcf7-submit").addClass("cf7du-disabled").on('click',disable_submit);$(".cf7du_files_loading_message").show();cf7du_currently_uploading++;if(layout=="thumbnails"){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').after('
');if(options.show_percentage){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append('
')}}else{$('#'+uploader_id+' #selected_file_'+i).append('
');if(options.show_percentage){$('#'+uploader_id+' #selected_file_'+i).append('
')}}
var size=file.size;var sliceSize=options.chunk_size;var start=0;var chunk=0;loop();function loop(){var end=start+sliceSize;if(size-end<0){end=size}
var s=slice(file,start,end);send(s,start,end,size,sliceSize);chunk++;if(end');$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail i').hide().delay(500).fadeIn("slow")}else if(file.type.match('audio/*')){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append(' ');$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail i').hide().delay(500).fadeIn("slow")}else{$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append(' ');$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail i').hide().delay(500).fadeIn("slow")}
var du_delete_button=$(' ').hide();if(layout=="thumbnails"){$('#'+uploader_id+' #selected_file_'+i+' div.thumbnail').append(du_delete_button)}else if(layout=="list"){$('#'+uploader_id+' #selected_file_'+i).append(du_delete_button)}
du_delete_button.delay(500).fadeIn("slow");$('#'+uploader_id).append(' ');$('#'+uploader_id+' #selected_file_'+i+' i.action-delete').on("click",function(event){var fileid=$(this).data("fileid");$.ajax({url:delete_url,data:"action=cf7du_upload_file&fileid="+fileid,}).done(function(){$('#'+uploader_id+' #selected_file_'+i).delay(500).fadeOut("slow");$('#'+uploader_id+' #hidden_file_'+i).remove();added_files--})});if(cf7du_currently_uploading==0){$('#'+uploader_id).closest("form").find(".wpcf7-submit").removeClass("cf7du-disabled").off('click',disable_submit);$(".cf7du_files_loading_message").hide()}}}}
xhr.send(formdata)}}
function slice(file,start,end){var slice=file.mozSlice?file.mozSlice:file.webkitSlice?file.webkitSlice:file.slice?file.slice:noop;return slice.bind(file)(start,end)}
function noop(){}
function remove_file(i){$('#'+uploader_id+' #selected_file_'+i).delay(options.time_show_errors*1000).fadeOut("slow")}
function set_error(text){$('#'+uploader_id+' .errors').html(''+text+'
');if(options.time_show_errors>0){setTimeout(clear_error,options.time_show_errors*1000)}}
function clear_error(){$('#'+uploader_id+' .errors p').fadeOut("slow",function(){$('#'+uploader_id+' .errors p').remove()})}
function get_file_size_readable(bytes){if(bytes>=1000000000){bytes=(bytes/1000000000).toFixed(2)+' GB'}else if(bytes>=1000000){bytes=(bytes/1000000).toFixed(2)+' MB'}else if(bytes>=1000){bytes=(bytes/1000).toFixed(2)+' KB'}else if(bytes>1){bytes=bytes+' bytes'}else if(bytes==1){bytes=bytes+' byte'}else{bytes='0 byte'}
return bytes};function check_files(files){var allow_file_add=!0;if(file_multiple){if(file_multiple_count){if((files.length+added_files)>file_multiple_count){set_error(options.allowed_before_error_text+' '+file_multiple_count+' '+options.allowed_after_error_text);if(submit_method=="normal"){added_files=0}
return!1}else{allow_file_add=!0}}else{allow_file_add=!0}}else{if(files.length>1||added_files>0){set_error(options.only_one_error_text);return!1}else{allow_file_add=!0}}
if(file_accept===undefined){allow_file_add=!0}else{var accept_array=file_accept.split(',');for(var i=0;i-1){match_count++}}else{if(files[i].type.match(match_string)!=null){match_count++}}}
if(match_count==0){set_error(options.not_allowed_error_text);return!1}}}
for(var i=0;imax_file_size&&max_file_size>0){set_error(options.big_file_before_error_text+' '+get_file_size_readable(max_file_size)+' '+options.big_file_after_error_text);return!1}}
return allow_file_add}
function maximizeInput(v){var drop_zone=$(v).parent(".drop_zone");var position=drop_zone.position();var top=position.top+parseInt(drop_zone.css('marginTop'),10);var left=position.left+parseInt(drop_zone.css('marginLeft'),10);$(v).css({top:top,left:left,position:'absolute',width:drop_zone.width(),height:drop_zone.height(),display:'block'})}
function minimizeInput(v){$(v).css({display:'none'})}
function get_random_id(){var text="";var possible="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(var i=0;i<15;i++)
text+=possible.charAt(Math.floor(Math.random()*possible.length));return text}
function draw_round_progress(el,percent,layout){var canvas=el.children[0];var color=hex_to_rgba(options.progress_color);if(canvas===undefined){canvas=document.createElement('canvas')}
if(layout=="thumbnails"){canvas.width=100;canvas.height=100;canvas.style.width="50px";canvas.style.height="50px";var diameter=96;var line_width=8}else{canvas.width=48;canvas.height=48;canvas.style.width="24px";canvas.style.height="24px";var diameter=48;var line_width=4}
el.appendChild(canvas);if(typeof(G_vmlCanvasManager)!=='undefined'){G_vmlCanvasManager.initElement(canvas)}
var ctx=canvas.getContext('2d');ctx.translate(diameter/2,diameter/2);ctx.rotate((-1/2+0/180)*Math.PI);var radius=(diameter-line_width)/2;percent=Math.min(Math.max(0,percent||1),1);ctx.beginPath();ctx.arc(0,0,radius,0,Math.PI*2*percent,!1);ctx.strokeStyle=color;ctx.lineCap='round';ctx.lineWidth=line_width;ctx.stroke()}
function hex_to_rgba(hex){var c;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){c=hex.substring(1).split('');if(c.length==3){c=[c[0],c[0],c[1],c[1],c[2],c[2]]}
c='0x'+c.join('');return'rgba('+[(c>>16)&255,(c>>8)&255,c&255].join(',')+',.8)'}else{return'rgba(74, 144, 226, .8)'}}
function getOrientation(file,callback){var reader=new FileReader();reader.onload=function(e){var view=new DataView(e.target.result);if(view.getUint16(0,!1)!=0xFFD8)return callback(-2);var length=view.byteLength,offset=2;while(offset