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

(function(c){var a=function(){};a.prototype=c.extend(a.prototype,{name:"ElementDownload",options:{url:"",directory:"images"},initialize:function(a,b){this.options=c.extend({},this.options,b);var d=this;a.find('input[name="reset-hits"]').bind("click",function(){c.ajax({url:d.options.url+"&task=callelement&method=reset",success:function(b){a.replaceWith(b)}})});a.find("select").bind("change",function(){a.find("input:text:first").val(c(this).val()?d.options.directory+c(this).val():"")})}});c.fn[a.prototype.name]=
function(){var e=arguments,b=e[0]?e[0]:null;return this.each(function(){var d=c(this);if(a.prototype[b]&&d.data(a.prototype.name)&&b!="initialize")d.data(a.prototype.name)[b].apply(d.data(a.prototype.name),Array.prototype.slice.call(e,1));else if(!b||c.isPlainObject(b)){var f=new a;a.prototype.initialize&&f.initialize.apply(f,c.merge([d],e));d.data(a.prototype.name,f)}else c.error("Method "+b+" does not exist on jQuery."+a.name)})}})(jQuery);
(function(c){var a=function(){};a.prototype=c.extend(a.prototype,{name:"DownloadSubmission",initialize:function(a){var b=this;this.element=a;this.advanced=a.find("select.upload");this.select_upload=this.advanced.length?this.advanced:a.find("input.upload");a.find("span.download-cancel").bind("click",function(){b.select_upload.val("");a.find("div.download-limit input").val("");b.sanatize()});this.advanced.length&&this.select_upload.bind("change",function(){a.find("span.preview").text(b.select_upload.val().replace(/^.*[\/\\]/g,
""));b.sanatize()});b.sanatize()},sanatize:function(){this.select_upload.val()?(this.element.find("div.download-select").addClass("hidden"),this.element.find("div.download-preview").removeClass("hidden")):(this.element.find("div.download-select").removeClass("hidden"),this.element.find("div.download-preview").addClass("hidden"))}});c.fn[a.prototype.name]=function(){var e=arguments,b=e[0]?e[0]:null;return this.each(function(){var d=c(this);if(a.prototype[b]&&d.data(a.prototype.name)&&b!="initialize")d.data(a.prototype.name)[b].apply(d.data(a.prototype.name),
Array.prototype.slice.call(e,1));else if(!b||c.isPlainObject(b)){var f=new a;a.prototype.initialize&&f.initialize.apply(f,c.merge([d],e));d.data(a.prototype.name,f)}else c.error("Method "+b+" does not exist on jQuery."+a.name)})}})(jQuery);
