jQuery.cookie=function(d,c,a){if(typeof c!="undefined"){a=a||{};if(c===null){c="";a=$.extend({},a);a.expires=-1}var b="";if(a.expires&&(typeof a.expires=="number"||a.expires.toUTCString)){if(typeof a.expires=="number"){b=new Date;b.setTime(b.getTime()+a.expires*24*60*60*1E3)}else b=a.expires;b="; expires="+b.toUTCString()}var e=a.path?"; path="+a.path:"",f=a.domain?"; domain="+a.domain:"";a=a.secure?"; secure":"";document.cookie=[d,"=",encodeURIComponent(c),b,e,f,a].join("")}else{c=null;if(document.cookie&&
document.cookie!=""){a=document.cookie.split(";");for(b=0;b<a.length;b++){e=jQuery.trim(a[b]);if(e.substring(0,d.length+1)==d+"="){c=decodeURIComponent(e.substring(d.length+1));break}}}return c}};


(function(a){function v(){}v.prototype={init:function(i,j){this.textArray=[];this.elements=[];this.options=j;this.jquery=i;this.n=-1;if(j.async===true)j.async=2;if(j.not){i=i.not(j.not);i=i.add(i.find("*").not(j.not)).not(a(j.not).find("*"))}else i=i.add(i.find("*"));this.jq=i;this.jql=this.jq.length;return this.process()},process:function(){this.n++;var i=this,j=this.options,p="",s=false,d=false,g=this.jq[this.n],c,f;if(this.n===this.jql){p=this.jquery.pushStack(this.elements,"nodesContainingText");
j.complete.call(p,p,this.textArray);if(j.returnAll===false&&j.walk===false)return this.jquery;return p}if(!g)return this.process();c=a(g);f=g.nodeName.toUpperCase();var k=f==="INPUT"&&a.attr(g,"type").toLowerCase();if({SCRIPT:1,NOSCRIPT:1,STYLE:1,OBJECT:1,IFRAME:1}[f])return this.process();if(typeof j.subject==="string")p=c.attr(j.subject);else if(j.altAndVal&&(f==="IMG"||k==="image"))p=c.attr("alt");else if(j.altAndVal&&{text:1,button:1,submit:1}[k])p=c.val();else if(f==="TEXTAREA")p=c.val();else{f=
g.firstChild;if(j.walk!==true)d=true;else for(;f;){if(f.nodeType==1){d=true;break}f=f.nextSibling}if(d){if(j.walk!==true)s=true;for(f=g.firstChild;f;){if(f.nodeType==3&&f.nodeValue.match(/\S/)!==null)if(f.nodeValue.match(/<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)>/)!==null){if(f.nodeValue.match(/(\S+(?=.*<))|(>(?=.*\S+))/)!==null){s=true;break}}else{s=true;break}f=f.nextSibling}if(s){p=c.html();p=j.stripScripts?p.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,""):p;this.jq=this.jq.not(c.find("*"))}}else p=
c.text()}if(!p)return this.process();this.elements.push(g);this.textArray.push(p);j.each.call(g,this.elements.length-1,g,p);if(j.async){setTimeout(function(){i.process()},j.async);return this.jquery}else return this.process()}};var q={not:"",async:false,each:function(){},complete:function(){},comments:false,returnAll:true,walk:true,altAndVal:false,subject:true,stripScripts:true};a.fn.nodesContainingText=function(i){i=a.extend({},q,a.fn.nodesContainingText.defaults,i);return(new v).init(this,i)};a.fn.nodesContainingText.defaults=
q})(jQuery);
(function(a){function v(){}function q(){a.translate.GL=n=google.language;a.translate.GLL=t=n.Languages;u=a.translate.toLanguageCode;a.each(t,function(e,h){z[h.toUpperCase()]=e});a.translate.isReady=c;for(var b;b=B.shift();)b()}function i(b,e){var h={};a.each(b,function(l,r){if(e(r,l)===c)h[l]=r});return h}function j(b,e,h){return function(){return b.apply(e===c?arguments[0]:e,h||arguments)}}function p(b){return b!==k}function s(b,e,h){b=a.grep(b,p);var l,r={};a.each(e,function(m,w){m=a.grep(w[0],
function(x,y){return p(b[y])&&b[y].constructor===x}).length;if(m===b.length&&m===w[0].length&&(l=c)){a.each(w[1],function(x,y){r[y]=b[x]});return f}});if(!l)throw h;return r}function d(b,e){b=s(b,a.translate.overload,"jQuery.translate: Invalid arguments");var h=b.options||{};delete b.options;h=a.extend({},A,e,a.extend(h,b));if(h.fromOriginal)h.toggle=c;if(h.toggle)h.data=c;if(h.async===c)h.async=2;return h}function g(){this.extend(a.translate);delete this.defaults;delete this.fn}var c=true,f=false,
k,o="".replace,n,t,u,z={},C,B=[],A={from:"",to:"",start:v,error:v,each:v,complete:v,onTimeout:v,timeout:0,stripComments:c,stripWhitespace:c,stripScripts:c,separators:/\.\?\!;:/,limit:1750,walk:c,returnAll:f,replace:c,rebind:c,data:c,setLangAttr:f,subject:c,not:"",altAndVal:c,async:f,toggle:f,fromOriginal:c};g.prototype={version:"1.4.1",_init:function(b,e){var h=e.separators.source||e.separators,l=this.isString=typeof b==="string";a.each(["stripComments","stripScripts","stripWhitespace"],function(r,
m){r=a.translate[m];if(e[m])b=l?r(b):a.map(b,r)});this.rawSource="<div>"+(l?b:b.join("</div><div>"))+"</div>";this._m3=new RegExp("["+h+"](?![^"+h+"]*["+h+"])");this.options=e;this.from=e.from=u(e.from)||"";this.to=e.to=u(e.to)||"";this.source=b;this.rawTranslation="";this.translation=[];this.i=this.startPos=0;this.stopped=f;this.elements=e.nodes;e.start.call(this,b,e.from,e.to,e);if(e.timeout)this.timeout=setTimeout(j(e.onTimeout,this,[b,e.from,e.to,e]),e.timeout);e.toggle&&e.nodes?this._toggle():
this._process()},_process:function(){if(!this.stopped){var b=this.options,e=this.rawTranslation.length,h,l;this.rawSourceSub=this.truncate(this.rawSource.substr(this.startPos),b.limit);for(this.startPos+=this.rawSourceSub.length;(e=this.rawTranslation.lastIndexOf("</div>",e))>-1;){e=e-1;h=this.rawTranslation.substr(0,e+1);l=h.match(/<div[> ]/gi);h=h.match(/<\/div>/gi);l=l?l.length:0;h=h?h.length:0;if(l===h+1){e=a(this.rawTranslation.substr(0,e+7));l=e.length;var r=this.i;if(r===l)break;e.slice(r,
l).each(j(function(m,w){if(this.stopped)return f;w=a(w).html().replace(/^\s/,"");m=r+m;var x=this.source,y=!this.from&&this.detectedSourceLanguage||this.from;this.translation[m]=w;this.isString?(this.translation=w):(x=this.source[m]);b.each.call(this,m,w,x,y,this.to,b);this.i++},this));break}}this.rawSourceSub.length?this._translate():this._complete()}},_translate:function(){n.translate(this.rawSourceSub,this.from,this.to,j(function(b){if(b.error)return this.options.error.call(this,b.error,this.rawSourceSub,
this.from,this.to,this.options);this.rawTranslation+=b.translation||this.rawSourceSub;this.detectedSourceLanguage=b.detectedSourceLanguage;this._process()},this))},_complete:function(){clearTimeout(this.timeout);this.options.complete.call(this,this.translation,this.source,!this.from&&this.detectedSourceLanguage||this.from,this.to,this.options)},stop:function(){if(this.stopped)return this;this.stopped=c;this.options.error.call(this,{message:"stopped"});return this}};a.translate=function(b,e){if(b==
k)return new g;if(a.isFunction(b))return a.translate.ready(b,e);var h=new g,l=[].slice.call(arguments,0);l.shift();return a.translate.ready(j(h._init,h,[b,d(l,a.translate.defaults)]),f,h)};a.translate.fn=a.translate.prototype=g.prototype;a.translate.fn.extend=a.translate.extend=a.extend;a.translate.extend({_bind:j,_filter:i,_validate:s,_getOpt:d,_defaults:A,defaults:a.extend({},A),capitalize:function(b){return b.charAt(0).toUpperCase()+b.substr(1).toLowerCase()},truncate:function(b,e){var h,l,r,m,
w=encodeURIComponent(b);for(b=0;b<10;b++){try{m=decodeURIComponent(w.substr(0,e-b))}catch(x){continue}if(m)break}return!(h=/<(?![^<]*>)/.exec(m))?!/>\s*$/.exec(m)?(l=this._m3.exec(m))?(r=/>(?![^>]*<)/.exec(m))?l.index>r.index?m.substring(0,l.index+1):m.substring(0,r.index+1):m.substring(0,l.index+1):m:m:m.substring(0,h.index)},getLanguages:function(b,e){if(b==k||e==k&&!b)return t;var h={},l=typeof b,r=e?a.translate.getLanguages(b):t;if(b=l==="object"||l==="function"?b:e)if(b.call)h=i(r,b);else{e=
0;l=b.length;for(var m;e<l;e++){m=a.translate.toLanguage(b[e]);if(r[m]!=k)h[m]=r[m]}}else h=i(t,n.isTranslatable);return h},toLanguage:function(b,e){var h=b.toUpperCase();b=z[h]||(t[h]?h:k)||z[(a.translate.languageCodeMap[b.toLowerCase()]||"").toUpperCase()];return b==k?k:e==="lowercase"?b.toLowerCase():e==="capitalize"?a.translate.capitalize(b):b},toLanguageCode:function(b){return t[b]||t[a.translate.toLanguage(b)]||a.translate.languageCodeMap[b.toLowerCase()]},same:function(b,e){return b===e||u(b)===
u(e)},isTranslatable:function(b){return n.isTranslatable(u(b))},languageCodeMap:{he:"iw",zlm:"ms","zh-hans":"zh-CN","zh-hant":"zh-TW"},isRtl:{ar:c,iw:c,fa:c,ur:c,yi:c},getBranding:function(){return a(n.getBranding.apply(n,arguments))},load:function(b,e){function h(){google.load("language",e||"1",{callback:q})}C=c;typeof google!=="undefined"&&google.load?h():a.getScript("http://www.google.com/jsapi?"+(b?"key="+b:""),h);return a.translate},ready:function(b,e,h){a.translate.isReady?b():B.push(b);!C&&
!e&&a.translate.load();return h||a.translate},isReady:f,overload:[[[],[]],[[String,String,Object],["from","to","options"]],[[String,Object],["to","options"]],[[Object],["options"]],[[String,String],["from","to"]],[[String],["to"]],[[String,String,Function],["from","to","complete"]],[[String,Function],["to","complete"]]],stripScripts:j(o,c,[/<script[^>]*>([\s\S]*?)<\/script>/gi,""]),stripWhitespace:j(o,c,[/\s\s+/g," "]),stripComments:j(o,c,[/<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)>/g,""])})})(jQuery);
(function(a){function v(d,g){var c=d.css("text-align");d.css("direction",g);c==="right"&&d.css("text-align","left");c==="left"&&d.css("text-align","right")}function q(d,g){var c=d.nodeName.toUpperCase();d=c==="INPUT"&&a.attr(d,"type").toLowerCase();g=g||{altAndVal:i,subject:i};return typeof g.subject==="string"?g.subject:g.altAndVal&&(c==="IMG"||d==="image")?"alt":g.altAndVal&&j[d]?"$val":c==="TEXTAREA"?"$val":"$html"}var i=true,j={text:i,button:i,submit:i},p={SCRIPT:i,NOSCRIPT:i,STYLE:i,OBJECT:i,
IFRAME:i},s=a([]);s.length=1;a.translate.fn._toggle=function(){var d=this.options,g=d.to,c;this.elements.each(a.translate._bind(function(f,k){this.i=f;var o=a(k),n=a.translate.getData(o,g,d);if(!n)return!(c=i);this.translation.push(n);this.replace(o,n,g,d);this.setLangAttr(o,g,d);d.each.call(this,f,k,n,this.source[f],this.from,g,d)},this));!c?this._complete():this._process()};a.translate.extend({_getType:q,each:function(d,g,c,f,k,o,n){s[0]=g;a.translate.setData(s,o,c,k,f,n);a.translate.replace(s,
c,o,n);a.translate.setLangAttr(s,o,n)},getData:function(d,g,c){d=d[0]||d;var f=a.data(d,"translation");return f&&f[g]&&f[g][q(d,c)]},setData:function(d,g,c,f,k,o){if(!(o&&!o.data)){d=d[0]||d;o=q(d,o);var n=a.data(d,"translation");n=n||a.data(d,"translation",{});(n[f]=n[f]||{})[o]=k;(n[g]=n[g]||{})[o]=c}},replace:function(d,g,c,f){if(!(f&&!f.replace)){if(f&&typeof f.subject==="string")return d.attr(f.subject,g);var k=d[0]||d,o=k.nodeName.toUpperCase(),n=o==="INPUT"&&a.attr(k,"type").toLowerCase(),
t=a.translate.isRtl,u=a.data(k,"lang");if(u!==c){if(t[c]!==t[u||f&&f.from])if(t[c])v(d,"rtl");else d.css("direction")==="rtl"&&v(d,"ltr");if((!f||f.altAndVal)&&(o==="IMG"||n==="image"))d.attr("alt",g);else if(o==="TEXTAREA"||(!f||f.altAndVal)&&j[n])d.val(g);else if(!f||f.rebind){f=d.find("*").not("script");g=a("<div/>").html(g);a.translate.copyEvents(f,g.find("*"));d.html(g.contents())}else d.html(g);a.data(k,"lang",c)}}},setLangAttr:function(d,g,c){if(!c||c.setLangAttr)d.attr(!c||c.setLangAttr===
i?"lang":c.setLangAttr,g)},copyEvents:function(d,g){g.each(function(c,f){c=d[c];if(!f||!c)return false;if(p[c.nodeName.toUpperCase()])return i;c=a.data(c,"events");if(!c)return i;for(var k in c)for(var o in c[k])a.event.add(f,k,c[k][o],c[k][o].data)})}});a.fn.translate=function(){var d=a.translate._getOpt(arguments,a.fn.translate.defaults),g=a.extend({},a.translate._defaults,a.fn.translate.defaults,d,{complete:function(c,f){a.translate(function(){function k(t){return function(){[].unshift.call(arguments,
this.elements);t.apply(this,arguments)}}var o=a.translate.toLanguageCode(d.from);d.fromOriginal&&c.each(function(t,u){s[0]=u;u=a.translate.getData(s,o,d);if(!u)return true;f[t]=u});var n=d.each;d.nodes=c;d.start=k(d.start);d.onTimeout=k(d.onTimeout);d.complete=k(d.complete);d.each=function(t){var u=arguments;arguments.length!==7&&[].splice.call(u,1,0,this.elements[t]);this.each.apply(this,u);n.apply(this,u)};a.translate(f,d)})},each:function(){}});if(this.nodesContainingText)return this.nodesContainingText(g);
d.nodes=this;a.translate(a.map(this,function(c){return a(c).html()||a(c).val()}),d);return this};a.fn.translate.defaults=a.extend({},a.translate._defaults)})(jQuery);
(function(a){var v={tags:["select","option"],filter:a.translate.isTranslatable,label:a.translate.toNativeLanguage||function(q,i){return a.translate.capitalize(i)},includeUnknown:false};a.translate.ui=function(){var q={},i="",j="",p="";if(typeof arguments[0]==="string")q.tags=a.makeArray(arguments);else q=arguments[0];q=a.extend({},v,a.translate.ui.defaults,q);if(q.tags[2]){j="<"+q.tags[2]+">";p="</"+q.tags[2]+">"}var s=a.translate.getLanguages(q.filter);q.includeUnknown||delete s.UNKNOWN;a.each(s,
function(d,g){i+="<"+q.tags[1]+" value="+g+">"+j+q.label(g,d)+p+"</"+q.tags[1]+">"});return a("<"+q.tags[0]+' class="jq-translate-ui">'+i+"</"+q.tags[0]+">")};a.translate.ui.defaults=a.extend({},v)})(jQuery);
(function(a){a.translate.extend({toNativeLanguage:function(v){return a.translate.nativeLanguages[v]||a.translate.nativeLanguages[a.translate.toLanguageCode(v)]},nativeLanguages:{af:"Afrikaans",be:"\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f",is:"\u00cdslenska",ga:"Gaeilge",mk:"\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438",ms:"Bahasa Melayu",sw:"Kiswahili",cy:"Cymraeg",yi:"\u05d9\u05d9\u05b4\u05d3\u05d9\u05e9",sq:"Shqipe",ar:"\u0627\u0644\u0639\u0631\u0628\u064a\u0629",
bg:"\u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438",ca:"Catal\u00e0",zh:"\u4e2d\u6587","zh-CN":"\u7b80\u4f53\u4e2d\u6587","zh-TW":"\u7e41\u9ad4\u4e2d\u6587",hr:"Hrvatski",cs:"\u010ce\u0161tina",da:"Dansk",nl:"Nederlands",en:"English",et:"Eesti",tl:"Tagalog",fi:"Suomi",fr:"Fran\u00e7ais",gl:"Galego",de:"Deutsch",el:"\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac",iw:"\u05e2\u05d1\u05e8\u05d9\u05ea",hi:"\u0939\u093f\u0928\u094d\u0926\u0940",hu:"Magyar",id:"Bahasa Indonesia",it:"Italiano",
ja:"\u65e5\u672c\u8a9e",ko:"\ud55c\uad6d\uc5b4",lv:"Latvie\u0161u",lt:"Lietuvi\u0173",mt:"Malti",no:"Norsk",fa:"\u0641\u0627\u0631\u0633\u06cc",pl:"Polski","pt-PT":"Portugu\u00eas",ro:"Rom\u00e2n",ru:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439",sr:"\u0421\u0440\u043f\u0441\u043a\u0438",sk:"Slovensk\u00fd",sl:"Slovenski",es:"Espa\u00f1ol",sv:"Svenska",th:"\u0e44\u0e17\u0e22",tr:"T\u00fcrk\u00e7e",uk:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",vi:"Ti\u1ebfng Vi\u1ec7t"}})})(jQuery);


// html5 stuff
document.createElement('footer');
document.createElement('section');
document.createElement('nav');

// does the actual page translation
function translateTo( destLang ){
  $('body').translate(destLang, {
      not:          'pre, .jq-translate-ui',
      start:        function(){$('#translate-loading').show();},
      complete:     function(){$('#translate-loading').hide();}
      }
  );
}

$(document).ready(function(){
  $("a[href^='http://']").click(function(){
    _gaq.push(['_trackPageview', '/outgoing/'+ $(this).attr('href')]);
  });
  $("a[rel*='download']").click(function(){
    _gaq.push(['_trackEvent', 'Downloads', $(this).attr('class'), $(this).attr('href')]);
  });

  // load the search form if needed
  if ($('#search').length > 0){
    $('#translate').empty();
    $.getScript('http://www.google.com/jsapi',function(){
      google.load("search", "1",{
        "callback":function(){
          new google.search.CustomSearchControl('006642745289971045904:gieh-hxojic').draw('search');
        }
      });
    });

  }else{

    //when the Google Language API is loaded
    $.translate(function(){
      // hide the loading stuff
      $('#translate-loading').hide();
      //generate dropdown
      $.translate.ui({
        tags: ['select', 'option'],
        filter: $.translate.isTranslatable,
        label: $.translate.toNativeLanguage ||
         function(langCode, lang){
           return $.translate.capitalize(lang);
         },
         includeUnknown: false
        })
      // when selecting another language
      .change(function(){
        var lang = $(this).val();
        translateTo(lang);
        _gaq.push(['_trackEvent', 'Languages', lang+' (change)', document.location.href]);
        $.cookie('destLang', lang, {path:'/'});
        })
      .val('en') //select English as default
      .appendTo('#translate'); //insert the dropdown to the page

      //insert Google's logo after the dropdown:
      //$.translate.getBranding().appendTo($('#translate'));

      //get previously translated language
      var destLang = $.cookie('destLang');
      if (destLang && destLang != 'en') {
        $('.jq-translate-ui').val(destLang);
        translateTo( destLang );
        _gaq.push(['_trackEvent', 'Languages', destLang+' (stored)', document.location.href]);
      }
    });
  }
});


