/*
    translate and print 
*/
jQuery(function($){ //when DOM is ready

  $('body').css('height','800px');


  $.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',  //by default the generated element has this className
          fromOriginal:true   //always translate from english (even after the page has been translated)
        });
    }
    
        
    //you can generate other controls as well, not just a dropdown:
    $.translate.ui('ul', 'li', 'span')  
      .appendTo('#tras')                 //insert the element to the page
     // .css({'color':'white', 'background-color':'black'})
      .find('span')
      .css('cursor','pointer')
      .click(function(){   //when selecting another language
      
        translateTo( $(this).text() );
        
        $.cookie('destLang', $(this).text() ); 
        // set a cookie to remember the selected language
        // see: http://plugins.jquery.com/project/Cookie
        
        return false; //prevent default browser action
      })
    
    //var destLang = $.cookie('destLang'); //get previously translated language
    
    if( destLang )  //if it was set then
        translateTo( destLang );
    

  }); //end of Google Language API loaded
  
}) //end of DOM ready
