/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
function BackgroundImage(c){this.editor=c;var a=c.config;var b=this;a.registerButton({id:"bgImage",tooltip:Xinha._lc("Set page background image","BackgroundImage"),image:c.imgURL("ed_bgimage.gif","BackgroundImage"),textMode:false,action:function(d){b.show()}});a.addToolbarElement("bgImage","inserthorizontalrule",1)}BackgroundImage._pluginInfo={name:"BackgroundImage",version:"1.0",developer:"Udo Schmal",developer_url:"http://www.schaffrath-neuemedien.de/",c_owner:"Udo Schmal & Schaffrath NeueMedien",sponsor:"L.N.Schaffrath NeueMedien",sponsor_url:"http://www.schaffrath-neuemedien.de.de/",license:"htmlArea"};BackgroundImage.prototype.onGenerateOnce=function(b){var a=BackgroundImage;if(a.loading){return}var c={blufur:"",palecnvs:"",ppplcnvs:"",ylwsand:""};a.loading=true;a.methodsReady=true;Xinha._getback(Xinha.getPluginDir("BackgroundImage")+"/dialog.html",function(d){a.html=d.replace(/<template>(.*?)<\/template>/ig,function(i,h){var g="";for(bg in c){var e=Xinha.getPluginDir("BackgroundImage")+"/backgrounds/thumbnails/"+bg+".jpg";var f=Xinha.getPluginDir("BackgroundImage")+"/backgrounds/"+bg+".jpg";g+=h.replace(/%thumbnail%/,e).replace(/%image%/,f)}return g});a.dialogReady=true})};BackgroundImage.prototype.onUpdateToolbar=function(a){if(!(BackgroundImage.dialogReady&&BackgroundImage.methodsReady)){this.editor._toolbarObjects.BackgroundImage.state("enabled",false)}else{this.onUpdateToolbar=null}};BackgroundImage.prototype.prepareDialog=function(c){var a=this;var c=this.editor;var b=this.dialog=new Xinha.Dialog(c,BackgroundImage.html,"Xinha",{width:400});b.getElementById("set").onclick=function(){a.apply()};b.getElementById("delete").onclick=function(){a.deleteBg()};b.getElementById("cancel").onclick=function(){a.dialog.hide()};this.dialogReady=true};BackgroundImage.prototype.show=function(c){if(!this.dialog){this.prepareDialog()}var c=this.editor;if(c._doc.body.background.split(".").pop() in {jpg:"",gif:"",png:"",jpeg:"",tiff:""}){var b=c._doc.body.background}else{var b=""}var a={background:b};this.dialog.show(a)};BackgroundImage.prototype.deleteBg=function(){var a=this.editor;this.dialog.hide();if(Xinha.is_ie){a.focusEditor()}a._doc.body.background=""};BackgroundImage.prototype.apply=function(){var a=this.editor;var b=a._doc;var c=this.dialog.hide();if(Xinha.is_ie){a.focusEditor()}b.body.background=c.background};