
JS_LANGUAGES='Afrikaans,Albanian,Arabic,Belarusian,Bulgarian,Catalan,Chinese,Chinese_simplified,Chinese_traditional,Croatian,Czech,Danish,Dutch,English,Estonian,Filipino,Finnish,French,Galician,German,Greek,Hebrew,Hindi,Hungarian,Icelandic,Indonesian,Irish,Italian,Japanese,Korean,Latvian,Lithuanian,Macedonian,Malay,Maltese,Norwegian,Persian,Polish,Portuguese,Romanian,Russian,Serbian,Slovak,Slovenian,Spanish,Swahili,Swedish,Tagalog,Thai,Turkish,Ukrainian,Vietnamese,Welsh,Yiddish';
JS_LANGUAGES=JS_LANGUAGES.split(",");

function translateTo( destLang )
	{ //this can be declared in the global scope too if you need it somewhere else
     //  alert(gCurrentLanguage);
	   $('body').translate( "'"+gCurrentLanguage+"'", destLang, {   //translate from english to the selected language
          not: '.option, #demo, #source, pre, .jq-translate-ui, #language',  //by default the generated element has this className
          fromOriginal:true   //always translate from english (even after the page has been translated)
        });
    }

jQuery(function($){ //when DOM is ready
	
	
//	alert(gCurrentLanguage);
//  translateTo( gCurrentLanguage );
	
  $.translate(function(){
					   
					  // alert(gCurrentLanguage);
    //when the Google Language API is loaded
  
    
    //translateTo( gCurrentLanguage );
   
        
    //you can generate other controls as well, not just a dropdown:
 	$.translate.ui('select', 'option')
      .val(gCurrentLanguage)
	  .appendTo('#language')    //insert the element to the page
//      .css({'color':'blue', 'background-color':'white'})
//      .find('option')
 //     .css('cursor','pointer')
      .change(function()
	   {
	     //when selecting another language
//        alert($(this).attr("selectedIndex"));
		
//		alert(JS_LANGUAGES[$(this).attr("selectedIndex")]);
		CURRENT_LANGUAGE=JS_LANGUAGES[$(this).attr("selectedIndex")];
        translateTo( CURRENT_LANGUAGE );

          
		  set_language(CURRENT_LANGUAGE);
		  
		  //$.cookie('destLang', CURRENT_LANGUAGE ); 

        // set a cookie to remember the selected language
        // see: http://plugins.jquery.com/project/Cookie
        
        return false; //prevent default browser action
      })
	  //alert(gCurrentLanguage);
    translateTo( gCurrentLanguage );

    //var destLang = $.cookie('destLang'); //get previously translated language

    //if( destLang )  //if it was set then
	
	
    

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

	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' 	type='text/javascript'%3E%3C/script%3E"));

