jQuery(function($){		


		$.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)
		       });
		   }

			$.translate().ui('select','option')
		   .appendTo('#selectBox')    //insert the element to the page

		     .change(function(){   //when selecting another language	
		       translateTo( $(this).val() );
		       $.cookie('destLang', $(this).val() );
			   
		       // set a cookie to remember the selected language
		       return false; //prevent default browser action
	    	}
	    )
	    var destLang = $.cookie('destLang'); //get previously translated language
	    //alert(destLang);
 		if( destLang )  //if it was set then
	       translateTo( destLang );

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