/* Translate */
(function(){
function a(f){
var e={
langs:{
}
,theFlags:[],theDD:[],theAll:[],input:[],results:[],busy:0,ol:0,all:0,tr:0,undo:0,addEv:function(j,i,h){
if(j.attachEvent){
j["e"+i+h]=h;
j[i+h]=function(){
j["e"+i+h](window.event)}
;
j.attachEvent("on"+i,j[i+h])}
else{
j.addEventListener(i,h,false)}
}
,prev:function(h){
if(h&&h.preventDefault){
h.preventDefault()}
else{
if(window.event&&window.event.returnValue){
window.event.returnValue=false}
}
}
,trans:function(p){
function j(G){
function B(K,J,I,H){
i+=I+7;
if(i>=m){
o();
w(I+7)}
t.push(K);
v.push(H);
u+="<p>"+J+"</p>"}
if(e.hasClass(G,"notranslate")){
return}
switch(G.nodeType){
case 1:switch(G.tagName){
case"SCRIPT":case"STYLE":case"OBJECT":return;
break}
if(!G.innerHTML){
return}
var C=G.childNodes;
for(var D=0,x=C.length;
D<x;
D++){
j(C[D])}
break;
case 3:var A=G.nodeValue.replace(/</g,"&lt;"),E=A.length;
if(E<m){
B(G,A,E,0)}
else{
for(var F=0;
A.length;
F++){
B(G,A.substr(0,m),A.length,F?1:0);
A=A.substr(m)}
}
break}
}
function o(){
var x={
nodes:t,appends:v,html:u}
;
e.input.push(x);
h(x)}
function h(x){
e.busy++;
google.language.translate(x.html,e.o.fromLang,p,function(A){
if(e.cancel){
return}
if(!A.error){
k(x,A.translation)}
e.busy--;
if(!e.busy){
n(0)}
}
)}
function k(C,x){
var D=document.createElement("div");
D.innerHTML=x;
var F=C.nodes,I=C.appends,H=D.childNodes;
for(var E=0,G=H.length;
E<G;
E++){
thisTranslationNode=H[E].childNodes[0];
if(typeof thisTranslationNode!="undefined"){
var B=F[E],A=thisTranslationNode.nodeValue;
if(typeof B=="undefined"){
return}
B.nodeValue=I[E]?B.nodeValue+A:A}
}
}
function n(x){
function D(){
function G(){
F--;
if(F>-25){
e.undo.style.top=F+"px";
setTimeout(G,12)}
else{
y()}
}
if(e.undo){
var F=0;
G()}
}
e.wrap=document.getElementById(e.o.wrapper);
var A=e.findCTA();
e.buildCTA(A);
e.tr.style.display="none";
e.hideOL();
if(!x){
if(e.o.cookie){
e.setCookie(p,30)}
if(typeof e.o.onComplete=="function"){
e.o.onComplete(p)}
var B=document.createElement("div"),C=document.createElement("a");
B.className="ttb-undo";
B.innerHTML=e.o.doneText+"";
C.innerHTML=e.o.undoText;
try{
C.href="javascript:function Z(){Z=''}Z()"}
catch(E){
}
C.onclick=function(F){
e.prev(F);
D();
e.trans(0)}
;
B.appendChild(C);
document.body.appendChild(B);
e.undo=B;
//setTimeout(D,5000)
}
}
function q(){
var A=document.createElement("div"),x=document.createElement("a");
A.className="ttb-translating notranslate";
A.innerHTML=e.o.busyText+"<br />";
x.innerHTML=e.o.cancelText;
x.href="javascript:function Z(){Z=''}Z()";
x.onclick=function(B){
e.prev(B);
e.trans(0)}
;
A.appendChild(x);
document.body.appendChild(A);
return A}
function y(){
e.remove(e.undo);
e.undo=0}
function w(x){
t=[];
v=[];
u="";
i=x}
if(e.busy&&p){
return}
if(p&&!google.language.isFontRenderingSupported(p)){
alert("Sorry, your browser does not support "+e.langs[p]+" characters.");
return}
var t,v,u,i;
w(0);
var m=e.o.maxLength;
e.busy=1;
e.showOL();
if(e.tr){
e.remove(e.tr)}
e.tr=q();
e.centerXY(e.tr,100,25);
e.tr.style.display="block";
if(e.dd){
e.remove(e.dd);
e.dd=0;
e.theDD=[]}
if(e.all){
e.remove(e.all);
e.all=0;
e.theAll=[]}
if(p&&e.undo){
y()}
if(p&&p!=e.o.fromLang){
e.cancel=0;
if(!e.input.length||e.o.reparse){
e.input=[];
j(e.o.scope?document.getElementById(e.o.scope):document.body);
o()}
else{
var r=e.input;
for(var z=0,s=r.length;
z<s;
z++){
h(r[z])}
}
e.busy--;
if(!e.busy){
n(0)}
e.report(p);
if(typeof e.o.onClick=="function"){
e.o.onClick()}
}
else{
if(!e.cancel){
e.cancel=1;
e.setCookie("",-1);
var r=e.input;
for(var z=0,s=r.length;
z<s;
z++){
k(r[z],r[z].html)}
e.report(0);
e.busy=0;
n(1)}
}
}
,build:function(){
function h(){
var n=document.createElement("style"),p="display:block;overflow:hidden;text-indent:-2000px;",o="background:#FFF;border:1px solid #BBB;font-family:Arial;color:#555;",m=".ttb-panel{display:none;position:absolute;z-index:3500;font-size:12px;text-align:left;"+o+"} .ttb-panel .ttb-column{width:117px;float:left;margin:0 3px 0 0;} .ttb-panel a{color:#555}";
if(!e.o.noBtn){
m+=" #"+e.o.wrapper+" .translate{background:url('"+e.o.btnImg+"') no-repeat;visibility:visible;position:relative;width:"+e.o.btnWidth+"px;height:"+e.o.btnHeight+"px;float:left;"+p+"}"}
m+=" .ttb-more{float:right;padding:4px;} .ttb-close{display:block;position:absolute;top:3px;right:3px;height:16px;width:16px;}";
m+=" .ttb-cta{display:block;padding:4px 5px;text-decoration:none;cursor:pointer;} .ttb-cta:hover{background:#EEE;outline:1px solid #DDD;text-decoration:underline;}";
m+=" .translate-flag{background:url('"+e.o.bgImg+"') no-repeat;height:"+e.o.imgHeight+"px;width:"+e.o.imgWidth+"px;margin:0 6px 0 0;float:left;"+p+"}";
m+=" .ttb-overlay{position:absolute;top:0;left:0;z-index:3000;background:#222;filter:alpha(opacity=80);opacity:.8;} .ttb-translating{position:absolute;z-index:3500;height:80px;width:200px;font-size:16px;text-align:center;line-height:40px;"+o+"} .ttb-translating a{font-size:.8em;}";
m+=" .ttb-undo{position:fixed;width:100%;z-index:2000;top:0;left:0;padding:5px 0;text-align:center;background:url(assets/images/translate/semi-trans.png);font-family:Arial;border-bottom:2px solid #666;color:#fff;}";
n.type="text/css";
if(n.styleSheet){
n.styleSheet.cssText=m}
else{
n.appendChild(document.createTextNode(m))}
document.getElementsByTagName("head")[0].appendChild(n)}
e.wrap=document.getElementById(e.o.wrapper);
if(!e.wrap){
return}
var i=e.findCTA();
try{
i.href="javascript:function Z(){Z=''}Z()"}
catch(k){
}
if(e.o.cookie&&!e.busy){
var j=e.getCookie();
if(j){
e.trans(j)}
}
h();
e.wrap.style.height=e.o.btnHeight+"px";
e.buildCTA(i);
e.appendClear(e.wrap,1);
if(typeof e.o.onLoad=="function"){
e.o.onLoad()}
}
,buildFlag:function(k){
var i=document.createElement("a");
i.className="translate-"+k+" ttb-cta";
i.title="Translate into "+e.langs[k];
i.href="javascript:function Z(){Z=''}Z()";
var h=document.createElement("span");
h.className="translate-label";
h.innerHTML=e.langs[k];
if(e.o.noImg){
i.appendChild(h);
return i}
var j=document.createElement("span");
j.className="translate-flag";
j.style.backgroundPosition="0 "+(e.o.imgMap[k]*e.o.imgHeight*-1)+"px";
i.appendChild(j);
i.appendChild(h);
return i}
,findCTA:function(){
var h=e.wrap.childNodes;
for(var j=0;
j<h.length;
j++){
if(h[j].className=="translate"){
return h[j]}
}
return false}
,buildCTA:function(k){
function m(){
e.dd=e.buildPanel(1);
e.dd.style.width="250px";
e.dd.onmouseover=h;
e.dd.onmouseout=i}
function h(){
if(j){
clearTimeout(j);
return}
if(!e.dd){
m()}
var p=e.getPos(k);
e.dd.style.top="-1000px";
e.dd.style.display="block";
var q=e.dd.offsetWidth;
e.dd.style.left=p[0]+(document.body.offsetWidth-p[0]>q?0:k.offsetWidth-q)+"px";
var o=e.dd.offsetHeight;
e.dd.style.top=p[1]+(Math.max(e.wHeight(),document.body.offsetHeight)-p[1]>o?k.offsetHeight:-1*o)+"px"}
function i(){
j=setTimeout(n,500)}
function n(){
j=0;
if(e.dd.style){
e.dd.style.display="none"}
}
var j=0;
k.onclick=e.showAll;
k.onmouseover=h;
k.onmouseout=i}
,buildPanel:function(v){
function s(p,z,i){
var A=document.createElement("span");
//A.href=e.lynx;
//A.title=z;
//A.target="_blank";
A.innerHTML=p;
if(i){
A.style.cssFloat="right";
A.style.styleFloat="right"}
j.appendChild(A)}
function y(p){
e.prev(p);
var i=e.getTar(p.target||p.srcElement);
if(e.hasClass(i,"ttb-cta")){
e.flagClick(p,i,w,k)}
else{
if(e.hasClass(i,"ttb-more")){
e.showAll()}
else{
if(e.hasClass(i,"ttb-close")){
e.hideAll()}
}
}
return false}
if(v){
var w=e.theDD,k=e.o.ddLangs,t=2,m=0}
else{
var w=e.theAll,k=e.o.allLangs,t=4,m="5px"}
var h=document.createElement("div");
h.className="ttb-panel";
h.innerHTML='<div style="background:#EEE;border-bottom:1px solid #DDD;padding:4px 5px;">'+e.o.panelText+'</div><div style="padding:5px 0 '+m+' 5px;"></div><div style="background:#EEE;border-top:1px solid #DDD;font-size:10px;padding:1px 5px;"></div>';
document.body.appendChild(h);
var o=h.childNodes[1],r=[],j=h.childNodes[2];
for(var n=0;
n<t;
n++){
r[n]=document.createElement("div");
r[n].className="ttb-column";
o.appendChild(r[n])}
var x=0;
for(var n=0;
n<k.length;
n++){
var q=e.buildFlag(k[n]);
if(n>=k.length/t*(x+1)){
x++}
r[x].appendChild(q);
if(v){
e.theDD.push(q)}
else{
e.theAll.push(q)}
}
e.addEv(o,"click",y);
//s("TranslateThis Button","Get your own TranslateThis Button",!v);
s("Translation powered by Google","",1);
if(!v){
//s("What's This?","What is the TranslateThis Button?",0)
}
var u=document.createElement("a");
u.style.cursor="pointer";
if(v){
u.className="ttb-more";
u.innerHTML=e.o.moreText}
else{
u.className="ttb-close";
if(e.o.noImg){
u.innerHTML="X"}
else{
u.style.backgroundImage='url("'+e.o.bgImg+'")';
u.style.backgroundPosition="0 -624px"}
u.title="Close"}
o.appendChild(u);
e.appendClear(o,0);
return h}
,appendClear:function(j,i){
var h=document.createElement("div");
h.style.margin="0";
h.style.padding="0";
if(i){
h.style.width="100%";
h.style.height="1px"}
else{
h.style.clear="both"}
j.appendChild(h)}
,getPos:function(h){
var i=curtop=0;
if(h.offsetParent){
do{
i+=h.offsetLeft;
curtop+=h.offsetTop}
while(h=h.offsetParent);
return[i,curtop]}
}
,getTar:function(h){
if(h.tagName!="A"){
h=h.parentNode}
return h}
,flagClick:function(n,h,k,m){
function o(r,q){
for(var p=0;
p<q.length;
p++){
if(r==q[p]){
return p}
}
}
e.hideAll(n);
var j=o(h,k);
e.o.doneText= "This page has been translated into "+e.langs[m[j]]+" by Google &nbsp;|&nbsp; back to ";
e.trans(m[j])
}
,showOL:function(){
function i(){
var j=document.createElement("div");
j.className="ttb-overlay";
document.body.appendChild(j);
j.onclick=function(k){
e.hideAll(k);
e.hideOL();
if(e.busy){
e.tr.style.display="none"}
}
;
window.onresize=function(k){
e.resize=setTimeout(h,80)}
;
return j}
function h(){
if(!e.olShow){
return}
var m=document,k=Math.max(Math.max(m.body.scrollWidth,m.documentElement.scrollWidth),Math.max(m.body.offsetWidth,m.documentElement.offsetWidth),Math.max(m.body.clientWidth,m.documentElement.clientWidth)),j=Math.max(Math.max(m.body.scrollHeight,m.documentElement.scrollHeight),Math.max(m.body.offsetHeight,m.documentElement.offsetHeight),Math.max(m.body.clientHeight,m.documentElement.clientHeight));
e.ol.style.width=k+"px";
e.ol.style.height=j+"px"}
e.olShow=1;
if(!e.ol){
e.ol=i()}
h();
e.ol.style.display="block";
if(e.dd){
e.dd.style.display="none"}
}
,hideOL:function(){
e.ol.style.display="none";
e.olShow=0}
,showAll:function(i){
function h(){
var j=e.buildPanel(0);
j.style.width="488px";
return j}
e.prev(i);
e.showOL();
if(!e.all){
e.all=h()}
e.centerXY(e.all,244,190);
e.all.style.display="block"}
,hideAll:function(h){
e.prev(h);
if(!e.all){
return}
e.all.style.display="none";
e.hideOL()}
,centerXY:function(k,j,i){
var h=0,m=0;
if(typeof(window.pageYOffset)=="number"){
m=window.pageYOffset;
h=window.pageXOffset}
else{
if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){
m=document.body.scrollTop;
h=document.body.scrollLeft}
else{
if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){
m=document.documentElement.scrollTop;
h=document.documentElement.scrollLeft}
}
}
h+=(e.wWidth()/2)-j;
m+=(e.wHeight()/2)-i;
k.style.top=m+"px";
k.style.left=h+"px"}
,wHeight:function(){
return window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight}
,wWidth:function(){
return window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth}
,remove:function(h){
h.parentNode.removeChild(h)}
,setCookie:function(i,j){
var h=new Date();
h.setTime(h.getTime()+j*8640000);
document.cookie=e.o.cookie+"="+i+"; expires="+h.toGMTString()+"; path=/"}
,getCookie:function(){
var k=e.o.cookie+"=",h=document.cookie.split(";");
for(var j=0;
j<h.length;
j++){
var m=h[j];
while(m.charAt(0)==" "){
m=m.substring(1,m.length)}
if(m.indexOf(k)==0){
return m.substring(k.length,m.length)}
}
return null}
,report:function(j){
if(e.o.GA&&j!="init"&&typeof pageTracker!="undefined"){
pageTracker._trackPageview("Translated-"+j)}
if("https:"==document.location.protocol){
return}
var h=new Image();
h.src=e.lynx+"translate.gif?x="+j;
//document.body.appendChild(h);
var i=setInterval(function(){
if(h.complete){
clearInterval(i);
e.remove(h)}
}
,90)}
,hasClass:function(j,h){
var i=" "+h+" ";
if((" "+j.className+" ").replace(/[\n\t]/g," ").indexOf(i)>-1){
return true}
return false}
}
;
e.lynx="";
var f=f||[];
f.wrapper=f.wrapper||"translate";
f.scope=f.scope||false;
f.bgImg=f.bgImg||"assets/images/translate/flags.png";
f.fromLang=f.fromLang||"en";
f.flags=f.flags||[];
f.ddLangs=f.ddLangs||["en","fr","es","nl","ga","ja","de","it","fi","sv","cy","zh-CN"];
f.imgMap=f.imgMap||{
af:10,sq:11,ar:6,be:12,bg:13,ca:50,"zh-CN":7,"zh-TW":14,hr:15,cs:16,da:17,nl:18,en:20,et:21,fi:22,fr:0,gl:51,de:1,el:23,iw:24,hi:25,hu:26,is:27,id:28,ga:29,it:4,ja:8,ko:9,lv:30,lt:31,mk:32,ms:33,mt:34,no:35,fa:36,pl:37,"pt-PT":3,ro:38,ru:5,sr:39,sk:40,sl:41,es:2,sw:42,sv:43,tl:44,th:45,tr:46,uk:47,vi:48,cy:49,yi:24}
;
if(f.allLangs===undefined){
f.allLangs=["af","sq","ar","be","bg","ca","zh-CN","zh-TW","hr","cs","da","nl","en","et","fi","fr","gl","de","el","iw","hi","hu","is","id","ga","it","ja","ko","lv","lt","mk","ms","mt","no","fa","pl","pt-PT","ro","ru","sr","sk","sl","es","sw","sv","tl","th","tr","uk","vi","cy","yi"]}
f.noBtn=f.noBtn||false;
f.btnWidth=f.btnWidth||180;
f.btnHeight=f.btnHeight||30;
f.noImg=f.noImg||false;
f.imgHeight=f.imgHeight||12;
f.imgWidth=f.imgWidth||18;
f.maxLength=f.maxLength||500;
f.reparse=f.reparse||false;
f.onLoad=f.onLoad||null;
f.onClick=f.onClick||null;
f.onComplete=f.onComplete||null;
f.GA=f.GA||false;
f.cookie=f.cookie!==undefined?f.cookie:"tt-lang";
f.undoText=f.undoText||"English";
f.panelText=f.panelText||"Translate Into:";
f.moreText=f.moreText||"40 More Languages &raquo;";
f.busyText=f.busyText||"Translating page...";
f.cancelText=f.cancelText||"cancel";
f.doneText=f.doneText||"This page has been translated by Google &nbsp;|&nbsp; back to ";
f.msie=/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||false;
f.btnImg=f.btnImg||"assets/images/translate/button.png";
e.o=f;
var b=google.language.Languages;
for(l in b){
var d=b[l],g=l.replace("_"," ").toLowerCase();
g=g.charAt(0).toUpperCase()+g.substr(1,g.length);
e.langs[d]=g}
e.langs["zh-CN"]="Chinese";
e.langs["zh-TW"]="Chinese (trad.)";
e.langs["pt-PT"]="Portuguese";
var c=(window.onload)?window.onload:function(){
}
;
window.onload=function(){
c();
new e.build()}
}
google.load("language","1");
window.Translate=a}
)();
