/*
- Release Notes - 
Product: Trans Pro
Version: 1.5
Date: June 24, 2009
Company: Scientific Marketing Services
Developer: Peter Rjabanedelia

Upgrades:
	1. Updated JQuery Translate Plugin to 1.3.7
	2. Updated JQuery Pack to 1.3.2
	3. Rebuilt caller script
	4. Dynamic select menu replaced with static HTML select menu

Corrected Issues:
	1. Tranlator would not function within IE8
	2. IE6, 7 & 8 would recognize .js errors
	3. Displaying of the "unknown" language has been corrected
	
Developer Notes:
	Trans Pro would not function within IE8 although all previous browsers were still supporting the translator at 100%.
	After upgrading all JQuery plugins to their latest release, some features became error prone and were not stable in any brower except for IE8.
	The cause of the errors and instability were found to be within the caller .js which made it necessary for the caller .js to be rebuilt.
	The new caller .js was built to perform through a static HTML select menu which adds control over languages to be displayed.
	Once the caller .js was rebuilt, all functions worked with the exception of the select menu being translated into the chosen language.
	To stop the select menu from translating, the original class name for the tranlation elements is used to block it from being translated.
*/

jQuery(function($){
 
  $.translate(function(){

    function translateTo( destLang ){ 
	
  		var tlc = $.translate().toLanguageCode
		
		if( tlc( destLang ) == "en" && tlc($.cookie("destLang")) == "en")
		
		return;
		
		$('body').translate( 'english', destLang, {
							
			 not: '.jq-translate-ui, noscript',
			 
			 fromOriginal:true
			 
	   }); 
		
    } 

  $('.jq-translate-ui')
  
         .change(function(){
						  
         translateTo( $(this).val() );
		 
         $.cookie('destLang', $(this).val(), { path: '/', domain: window.location.hostname }); 
		 
         return false;
			
      }) 

    var destLang = $.cookie('destLang');
     
    if( destLang )
	
    translateTo( destLang ); 
 
  });
   
})