/**************************************************************
 Script		: Google Translation Detector
 Version		: 1.0.2
 Author		: Joomler!.net
 Licence		: http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 **************************************************************/
google.load("language","1");var JGTdoc=function(){};JGTdoc.prototype={s:function(n){return document.getElementById(n);},d:function(m,n,f){if(!f)m.style.display=n;else return(m.style.display!=n);},opts:[],gid:'',stop:false,exec:function(){this.stop=false;if(this.gid!=''){var op=this.s('transouter'+this.gid);if(this.d(op,'',1)){this.d(op,'none');this.s('resulttrans'+this.gid).innerHTML='';}}if(this.opts[1]==''||this.opts[2]=='')return false;var docs=this.s('ajtrans'+this.opts[2]).innerHTML.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/<s[c|t][^(<\/s)]*<\/s[^>]+>/g,"\n").replace(/<[^>]+>/g,"\n").replace(/(\r\n|\n)+/g,"\n").replace(/(&nbsp;)+/g,'&nbsp;').split("\n");this.gid=this.opts[2];this.s('resulttrans'+this.opts[2]).innerHTML='';this.d(this.s('transouter'+this.opts[2]),'');this.d(this.s('ajax-loader'+this.opts[2]),'');var count=0;for(var i=0;i<docs.length;i++){if(docs[i].replace(/\s+/g,'').replace(/(&nbsp;)+/g,'')==''||this.stop)continue;if(this.opts[1].match(/toento/))this.translate(docs[i]+'19191919');else this.translate(docs[i]);}},b:function(o,f){return function(){return f.apply(o,arguments);};},translate:function(doc){var from=this.opts[0];if(this.opts[1].match(/toento/)){if(doc.match(/19191919/)){var to='en';}else{var to=this.opts[1].replace('/toento/','');var from='en';}}else{var to=this.opts[1];}google.language.translate(doc,from,to,this.b(this,this.transResult));},transResult:function(result){if(this.stop)return;var el=this.s('resulttrans'+this.gid);var txt=el.innerHTML;if(!result.error){this.d(el,'');if(txt!='')var sep="\n<br />";else var sep='';if(this.opts[1].match(/toento/)&&result.translation.match(/19191919/)){google.language.translate(result.translation.replace(/19191919/g,''),'en',this.opts[1].replace(/toento/,''),this.b(this,this.transResult));return;}if(result.translation.match(/^(\s)/)&&txt!='')var tag='';else var tag='</span>';var res=txt+sep+tag.replace(/\//,'')+result.translation+tag;}else{if(this.opts[3])var res=txt+"\n<br /><span id=\"error\">"+this.opts[3]+"</span>";else var res=txt+"\n<br /><span id=\"error\">Error: not possible to translate</span>";}this.d(this.s('ajax-loader'+this.gid),'none');el.innerHTML=res;}};
