$(document).ready(function() {  

        /*SUBMENU BUBBLES*/
        $('.subMenu1 li').mouseenter(function() {
                $(this).children('.bubble').fadeIn('slow');
                $(this).children('a').css('color', '#ee7d10');
        }).mouseleave(function() {
                $(this).children('.bubble').fadeOut('slow');
                $(this).children('a').css('color', '#2C4957');
        });  
   
        /*CAROUSEL*/   
        $('.achievmentsCarousel').cycle({
                fx:      'fade',
                speed:    1000, 
                timeout:  4000,
                pause:    1,
                pager:   '#nav',
                cleartype:  true,
                cleartypeNoBg:  true
        });                      
        $('#slogan').cycle({
                fx:      'fade',
                speed:    1000, 
                timeout:  3000,
                pause:    1,
                cleartype:  true,
                cleartypeNoBg:  true
        });   

        /*PEOPLE*/
        $('.peopleCarouselArrow').click(function() {                
                $('#peopleCarousel').find('.itemActive').next('.item').addClass('itemActive');
                $('#peopleCarousel').find('.itemActive:first').removeClass('itemActive');
                
                $('#peopleCarousel').find('.itemTn1').next('.item').addClass('itemTn1');
                $('#peopleCarousel').find('.itemTn1:first').removeClass('itemTn1');
                
                $('#peopleCarousel').find('.itemTn2').next('.item').addClass('itemTn2');
                $('#peopleCarousel').find('.itemTn2:first').removeClass('itemTn2');    

                if(!$('#peopleCarousel .item').is('.itemTn2')) {                 
                        $('#peopleCarousel').find('.item:first').addClass('itemTn2');
                };                            
                if(!$('#peopleCarousel .item').is('.itemTn1')) {                 
                        $('#peopleCarousel').find('.item:first').addClass('itemTn1');
                };
                if(!$('#peopleCarousel .item').is('.itemActive')) {                 
                        $('#peopleCarousel').find('.item:first').addClass('itemActive');
                };                                                                       
        });
        
        /*ACCORDION*/   
        $('.accordion h4 a').click(function() {    
                if(!$(this).is('.active')) {            
                        $('.accordion .text').hide('slow');                                                
                        $(this).parent().next().next('.text').show('slow');                                
                        $('.accordion h4 a').removeClass('active');
                        $(this).addClass('active');                         
                }else{
                        $('.accordion h4 a').removeClass('active');
                        $(this).parent().next().next('.text').hide('slow');                                                             
                };
                return false;
        });          

        /*OFFICES*/   
        $('.contacts .linkMore a').click(function() {    
                if(!$(this).is('.active')) {            
                        $('.contactsMore').hide('slow');                                                
                        $(this).parent().parent().next('.contactsMore').show('slow');                                
                        $('.contacts .linkMore a').removeClass('active');
                        $(this).addClass('active');                         
                }else{
                        $('.contacts .linkMore a').removeClass('active');
                        $(this).parent().parent().next('.contactsMore').hide('slow');                                                     
                };
                return false;
        }); 
        
        /*SELECTBOXES*/
	$('.selectbox').selectbox();	        

        /*GALERIE*/
        $('.peopleGalleryTns a').click(function(){
                $('.peopleGalleryBig img').attr('src', $(this).attr('href'));
                return false;
        })                  
        
        /*AUTOCLEAR INPUT*/
        var clearMePrevious = '';
        $('.clearOnClick').focus(function(){
                if($(this).val()==$(this).attr('title'))
                {
                        clearMePrevious = $(this).val();
                        $(this).val('');
                }
        });
        $('.clearOnClick').blur(function(){
                if($(this).val()=='')
                {
                        $(this).val(clearMePrevious);
                }
        });
        
        /*DETECT BROWSER FF <= 3.5.X*/
        if ($.browser.mozilla && $.browser.version.substr(0, 5) <= '1.9.1') {        
                $('.searchForm fieldset .inputText input').css('padding-top', '14px');
                $('.searchForm fieldset .inputText input').css('height', '26px');                

                $('.select28445 .selectbox').css('padding-top', '15px');
                $('..select28445 .selectbox').css('height', '30px');                  
        }           
});

