/* Copyright (C) YOOtheme GmbH, YOOtheme Proprietary Use License (http://www.yootheme.com/license) */

(function(d){var a=function(){};d.extend(a.prototype,{name:"ImageSubmission",options:{uri:""},initialize:function(a,c){this.options=d.extend({},this.options,c);var b=this;this.element=a;this.advanced=a.find("select.image");this.select_image=this.advanced.length?this.advanced:a.find("input.image");a.find("span.image-cancel").bind("click",function(){b.select_image.val("");b.sanatize()});this.advanced.length&&this.select_image.bind("change",function(){a.find("img").attr("src",b.options.uri+b.select_image.val());
b.sanatize()});b.sanatize()},sanatize:function(){this.select_image.val()?(this.element.find("div.image-select").addClass("hidden"),this.element.find("div.image-preview").removeClass("hidden")):(this.element.find("div.image-select").removeClass("hidden"),this.element.find("div.image-preview").addClass("hidden"))}});d.fn[a.prototype.name]=function(){var e=arguments,c=e[0]?e[0]:null;return this.each(function(){var b=d(this);if(a.prototype[c]&&b.data(a.prototype.name)&&c!="initialize")b.data(a.prototype.name)[c].apply(b.data(a.prototype.name),
Array.prototype.slice.call(e,1));else if(!c||d.isPlainObject(c)){var f=new a;a.prototype.initialize&&f.initialize.apply(f,d.merge([b],e));b.data(a.prototype.name,f)}else d.error("Method "+c+" does not exist on jQuery."+a.name)})}})(jQuery);
