jQuery(function($){ //when DOM is ready
  $.translate(function(){  //when the Google Language API is loaded
    function translateTo( destLang ){ //this can be declared in the global scope too if you need it somewhere else
        $('body').translate( 'english', destLang, {   //translate from english to the selected language
          not: '.jq-translate-ui, .header',  //by default the generated element has this className
          fromOriginal:true   //always translate from english (even after the page has been translated)
        });
    }               
        translateTo( $(this).val() );
        $('#translator')
      .find('a')
      .click(function(){
         var lang = $(this).attr('id');
         translateTo( lang );  
      $('#tagline h2').css("letterSpacing","0.15em");
      $('#navigation li').css("marginRight","20px");
      $('#navigation li').css("fontSize","1.2em");
       $.cookie('destLang', lang );
        return false; //prevent default browser action
      })  
var destLang = $.cookie('destLang'); //get previously translated language 
     
    if( destLang ){  //if it was set then 
    translateTo( destLang );
      $('#tagline h2').css("letterSpacing","0.15em");
      $('#navigation li').css("marginRight","20px"); 
      $('#navigation li').css("fontSize","1.2em");
             }  
  }); 
	$("a.reset").click(function(){
	$.cookie('the_cookie', null);
        location.reload();
});
  }) 


