(function($){
		  
	$(document).ready(function(){
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////						   
		
		// -------------------------------------------------------------------------------------------------------
		// Translate
		// -------------------------------------------------------------------------------------------------------

		$.translate(function(){
		
			function translateTo( destLang ){
		 		$('body').translate( 'en', destLang, {
		 			not: '.jq-translate-ui',
		 			toggle: true,
				});
				// If you want to translate page titles
				//$('title').translate( 'english', destLang, { // Translate page titles
				//	fromOriginal: true,
				//});
			}
			
			$.translate().ui({
				  tags: ['select', 'option'],
				  filter: [
				  	'en', 
				  	'bg', 
				  	'zh', 
				  	'hr',
				  	'fr',
				  	'it',
				  	'ja',
				  	'ko',
				  	'pl',
				  	'pt',
				  	'es', 
				  	'tr',
				  	'uk'
				  	],
				  includeUnknown: false
			})
			.appendTo('#translator')    //insert the element to the page
			.val( 'en' )
			.change(function(){   //when selecting another language
				var newLang = $(this).val()
				//in v1.4 $(this).val() or $(this).attr("value") 
				// is always the exact language code!
				translateTo( $(this).val() );
				$.cookie('currLang', newLang, {path:'/'} );
				// set a cookie to remember the selected language
				// see: http://plugins.jquery.com/project/Cookie
				return false; //prevent default browser action
			});
			    
			var cookieLang = $.cookie('currLang',{path:'/'}); //get previously translated language
			if (cookieLang) {
				translateTo(cookieLang);
			}
			else{
				$.cookie('currLang', 'English', {path:'/'} );
				translateTo('English');
			}
		    
		});
		

	});

})(window.jQuery);

// non jQuery plugins below


