//copyright Brisbane Website Design 30.com.au
$(document).ready(function() {
	
/*  //Box hover effects ---------------------------------------------------------
  $(".box .content").hover(function () {
      $(this).prev("div").animate({opacity: 0}, {queue:false,duration:200});			
    }, function () {
      $(this).prev("div").animate({opacity: 1}, {queue:false,duration:400});			
    }
  );	
  $('.box').click(function() {
    window.location.href = $(this).find('a').attr('href');
    return(false);
  });*/
  
  //Automatic Google Translation via API --------------------------------------
  $.translate(function()
  { 
      function translateTo( destLang )
		{          
			 originalColor = '#262c33';
			 var tlc = $.translate().toLanguageCode 
			 if( tlc( destLang ) == "en" && tlc($.cookie("destLang")) == "en") 
			 {
				$('#flags ul').find('a').removeClass('load');
				return;
			 }
			 //translate from english to the selected language 
			 $('body').translate('en', destLang, 
			 {
				not: '#jq-translate-ui, .syntaxhighlighter, #nav, .transMenu, #footer_1',  //by default the generated element has this id  
				fromOriginal:true,   //always translate from english (even after the page has been translated) 
				start: function()
				{ 
				},   
				complete: function()
				{ 
					$('#flags').find('a.load').removeClass('load').addClass('finish');
				},  
				error: function()
				{ 
				} 
			 }); 
      } 
      $('#flags').find('a').click(function()
		{
			$('#flags').find('a').removeClass('finish');
			$(this).addClass('load');
			var lang = $(this).attr('id');
			translateTo( lang );
			$.cookie('destLang', lang );
			return false;
      });
		
      //if dont exist an cookie set browserlang to cookielang
      if( $.cookie("destLang") == null) $.cookie('destLang', browserlang);
      var destLang = $.cookie('destLang'); //get previously translated language 
      if( destLang ) translateTo( destLang ); 
  }); 

  
    
  //Forms ---------------------------------------------------------------------
  $("input[type=text], textarea").bind("focus",function(){
    $(this).addClass("formactive");
  });
  $("input[type=text], textarea").bind("blur",function(){
    $(this).removeClass("formactive");
  });


  //Navigation ----------------------------------------------------------------
  $("a.button").hover(function () {
      if (!$(this).hasClass('active')) $(this).animate({opacity: 1}, {queue:true, duration:200});			
    }, function () {
      if (!$(this).hasClass('active')) $(this).animate({opacity: 0.6}, {queue:true, duration:400});			
    }
  );	
  $("a.button").css('opacity', 0.6);	
  $("a.button.active").css('opacity', 1);	  
  $(".level_1 .trail a:first").css('opacity', 1).addClass('active');	  
  $("a.submenu.button").click(function() {
    return(false);
  });
});

            
