(function($){
	$.fn.clearDefault = function(){
		return this.each(function(){
			var default_value = $(this).val();
			$(this).focus(function(){
				if ($(this).val() == default_value) $(this).val('');
			});
			$(this).blur(function(){
				if ($(this).val() == '') $(this).val(default_value);
			});
		});
	};
})(jQuery);

$(function() {
	$('#slideshow_tabs').tabs('#slideshow .pane', {	
			rotate: true,			
			effect: 'fade'
		}).slideshow({
			autoplay: true,
			interval: 15000
		});

	$('#contact_trigger a, #footer_contact, #close_panel').click(function(){
	    $('#contact_target').slideToggle('slow');
      $('#contact_3').load('/inc/map #google_map');      	    
	    return false;
	});	
		
	$('input[type="text"]').clearDefault();

	$('.accordion').tabs('div', { 
		tabs: 'h3',  
		effect: 'slide',
		initialIndex: 0 
	});	
	
			$('#filter a').click(function() {
				$(this).css('outline','none');
				$('#filter .current').removeClass('current');
				$(this).parent().addClass('current');
				
        var filterVal = $(this).text().toLowerCase().replace(' ','_').replace('/', '_');
         						
				if(filterVal == 'all') {
					$('#clients > li').fadeIn().removeClass('hidden');
				}
				 
        else {
        	$('#clients > li').each(function() {
        		if(!$(this).hasClass(filterVal)) {
        			$(this).fadeOut('normal').addClass('hidden');
        		} else {
        			$(this).fadeIn('slow').removeClass('hidden');
        		}
        	});
        }
				
				return false;
			});

	    $('#clients img, .talent_thumbs img').tooltip({
	      effect: 'toggle',
	      position: 'top, center',
	    	relative: true
	    });	  
	    
      $('#timeline').flashembed('/flash/timeline/htx_history_timeline.swf');
      
      $('input[type="hidden"]').css('display', 'none');


      $('.gallery-item').click(function() {
        var galleryItem = $(this).attr('rel');
          $('#gallery-target').hide();
          $('#gallery-target').fadeIn('slow');
          $('#gallery-target').html('<img src="' + galleryItem + '" />');
        return false;
      });
         
});



