(function(){Downloadify=window.Downloadify={queue:{},uid:(new Date).getTime(),getTextForSave:function(a){var b=Downloadify.queue[a];if(b)return b.getData();return""},getFileNameForSave:function(a){var b=Downloadify.queue[a];if(b)return b.getFilename();return""},saveComplete:function(a){var b=Downloadify.queue[a];b&&b.complete();return!0},saveCancel:function(a){var b=Downloadify.queue[a];b&&b.cancel();return!0},saveError:function(a){var b=Downloadify.queue[a];b&&b.error();return!0},addToQueue:function(a){Downloadify.queue[a.queue_name]=a},getUID:function(a){a.id==""&&(a.id="downloadify_"+Downloadify.uid++);return a.id}},Downloadify.create=function(a,b){var c=typeof a=="string"?document.getElementById(a):a;return new Downloadify.Container(c,b)},Downloadify.Container=function(a,b){var c=this;c.el=a,c.enabled=!0,c.dataCallback=null,c.filenameCallback=null,c.data=null,c.filename=null;var d=function(){c.options=b,c.options.append||(c.el.innerHTML=""),c.flashContainer=document.createElement("span"),c.el.appendChild(c.flashContainer),c.queue_name=Downloadify.getUID(c.flashContainer),typeof c.options.filename==="function"?c.filenameCallback=c.options.filename:c.options.filename&&(c.filename=c.options.filename),typeof c.options.data==="function"?c.dataCallback=c.options.data:c.options.data&&(c.data=c.options.data);var a={queue_name:c.queue_name,width:c.options.width,height:c.options.height},d={allowScriptAccess:"always"},e={id:c.flashContainer.id,name:c.flashContainer.id};c.options.enabled===!1&&(c.enabled=!1),c.options.transparent===!0&&(d.wmode="transparent"),c.options.downloadImage&&(a.downloadImage=c.options.downloadImage),swfobject.embedSWF(c.options.swf,c.flashContainer.id,c.options.width,c.options.height,"10",null,a,d,e),Downloadify.addToQueue(c)};c.enable=function(){var a=document.getElementById(c.flashContainer.id);a.setEnabled(!0),c.enabled=!0},c.disable=function(){var a=document.getElementById(c.flashContainer.id);a.setEnabled(!1),c.enabled=!1},c.getData=function(){if(!c.enabled)return"";return c.dataCallback?c.dataCallback():c.data?c.data:""},c.getFilename=function(){return c.filenameCallback?c.filenameCallback():c.filename?c.filename:""},c.complete=function(){typeof c.options.onComplete==="function"&&c.options.onComplete()},c.cancel=function(){typeof c.options.onCancel==="function"&&c.options.onCancel()},c.error=function(){typeof c.options.onError==="function"&&c.options.onError()},d()},Downloadify.defaultOptions={swf:"media/downloadify.swf",downloadImage:"images/download.png",width:100,height:30,transparent:!0,append:!1}})(),typeof jQuery!="undefined"&&function(a){a.fn.downloadify=function(b){return this.each(function(){b=a.extend({},Downloadify.defaultOptions,b);var c=Downloadify.create(this,b);a(this).data("Downloadify",c)})}}(jQuery)