/* 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 LangMarks(f,d){this.editor=f;var a=f.config;var b=this;var c={};c[this._lc("&mdash; language &mdash;")]="";for(var e in a.LangMarks){if(typeof e!="string"){continue}c[this._lc(e)]=a.LangMarks[e]}a.registerDropdown({id:"langmarks",tooltip:this._lc("language select"),options:c,action:function(g){b.onSelect(g,this)},refresh:function(g){b.updateValue(g,this)}});a.addToolbarElement("langmarks","inserthorizontalrule",1)}LangMarks._pluginInfo={name:"LangMarks",version:"1.0",developer:"Udo Schmal",developer_url:"",sponsor:"L.N.Schaffrath NeueMedien",sponsor_url:"http://www.schaffrath-neuemedien.de/",c_owner:"Udo Schmal & Schaffrath NeueMedien",license:"htmlArea"};Xinha.Config.prototype.LangMarks={Greek:"el",English:"en",French:"fr",Latin:"la"};LangMarks.prototype._lc=function(a){return Xinha._lc(a,"LangMarks")};LangMarks.prototype.onGenerate=function(){this.editor.addEditorStylesheet(Xinha.getPluginDir("LangMarks")+"/lang-marks.css")};LangMarks.prototype.onSelect=function(e,d,b,g){var i=e._toolbarObjects[d.id];var f=i.element.selectedIndex;var c=i.element.value;var k=e.getParentElement();var j=true;var h=(k&&k.tagName.toLowerCase()=="span");var a=(b&&g&&k&&k.tagName.toLowerCase()==b);if(a){k.className="haslang";k.lang=c;e.updateToolbar();return}if(h&&f==0&&!/\S/.test(k.style.cssText)){while(k.firstChild){k.parentNode.insertBefore(k.firstChild,k)}k.parentNode.removeChild(k);e.updateToolbar();return}if(h){if(k.childNodes.length==1){k.className="haslang";k.lang=c;j=false;e.updateToolbar()}}if(j){e.surroundHTML('<span lang="'+c+'" class="haslang">',"</span>")}};LangMarks.prototype.updateValue=function(d,a){var f=d._toolbarObjects[a.id].element;var e=d.getAllAncestors();var h;for(var b=0;b<e.length;b++){if(e[b].lang){h=e[b]}}if(h){var j=f.options;var g=h.lang;for(var b=j.length;--b>=0;){var c=j[b];if(g==c.value){f.selectedIndex=b;return}}}else{f.selectedIndex=0}};