Cufon.replace('h1,h2,h3:not(h3.news-title)', {textShadow: 'none'});
Cufon.replace('#teasers .slide-content .slide-text-content h2', {textShadow: 'none'});
Cufon.replace('#footer h2.title', {textShadow: 'none'});

jQuery.extend( jQuery.easing,
{
	def: 'easeInSine',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	}

});


$(function(){
	Cufon.now();
	$.tools.tabs.addEffect("fastfade", function(i, done) {
		var current = this.getCurrentPane().css('z-index', 1);
			 
		this.getPanes().eq(i).css('z-index', 2).fadeIn(this.getConf().fadeInSpeed, function(){
		  current.fadeOut(0, done)
		})
	});	
	$('.messages').live('click', function(){$(this).fadeOut()})
	
  $('.normal-gallery .pager,#project-images .pager')
		.tabs('div.panes > div', {fadeInSpeed: 400, effect: 'fastfade', rotate:true})
		.slideshow({clickable:false, autoplay:true, interval: 5000});
		
	$.tools.tabs.addEffect("tesers", function(i, done) {
		var conf = this.getConf(), 
			 panes = this.getPanes(),
			 color = panes.eq(i).find('.bgcolor');
			
		this.getCurrentPane().fadeOut(conf.fadeOutSpeed, function(){
			panes.eq(i).fadeIn(conf.fadeInSpeed, done)
		})
			.parent().parent().find('.teaser-pager,ul.pager,.panes').animate({backgroundColor: color.css('background-color')}, conf.fadeOutSpeed+conf.fadeInSpeed)
	});

	$.tools.tabs.addEffect("lightbox", function(i, done) {
		var conf = this.getConf(), 
			 panes = this.getPanes(),
			 pane = panes.eq(i);
						
		this.getCurrentPane()
			.parent().css('height', this.getCurrentPane().height())
			.end()
			.fadeOut(conf.fadeOutSpeed, function(){pane.fadeIn(conf.fadeInSpeed, done )} )
			
		panes.parent().animate({height:panes.eq(i).height()}, conf.fadeInSpeed+conf.fadeOutSpeed, 'easeOutExpo')
			
	});	
				
  $('#homepage-teasers')
		.tabs('div.panes > div', {fadeInSpeed: 300, fadeOutSpeed:200, effect: 'tesers', rotate:true, initialIndex:0})
		.slideshow({clickable:false, autoplay:true, interval: 6000})
		
  $('#about .awards .tabs').tabs('div.panes-content .panes > div', {effect: 'lightbox', fadeOutSpeed:200, fadeInSpeed: 400})

	$('.next-image,.prev-image')
     .css('opacity',0)
     .hover(function(){$(this).stop().animate({opacity:1});}, function(){$(this).stop().animate({opacity:0});} )

	$('#awards-list .awards .awards-list').hide()
	$('a.show-awards').click(function(){
		$('#awards-list .awards .awards-list,#awards-list .awards .intro').animate({height:'toggle', opacity:'toggle'});
	})

	$(window).resize(function(){
		var margin = $(window).width()>960 ? -($(window).width()-960)/2 : 0;
		$('#awards-list .pane-content, #teasers, #about .about-image, #project-list-page .project-types, #news-node-page .project-types, .page-node .project-types, #news-list-wrapper .project-types, .services-header, .contacts-header').css({left: margin, marginRight: margin, width: Math.max($(window).width(),960)})
	}).resize()
	
	$('.views-field-field-project-thumb-fid .subtitle').each(function(){
	  $(this).show().data('h',$(this).height()).css({opacity:0, height:0})
	})
	
	$('.views-field-field-project-thumb-fid').hover(function(){
		if($.browser.webkit){
    	  $(this).find('.subtitle').stop().animate({height: $(this).find('.subtitle').data('h'), opacity: 0.95}, 200)
        }else{
        }
	  return false;
	}, function() {
	  $(this).find('.subtitle').stop().animate({height:0, opacity: 0}, 200)
	  return false;	  
	} )	
	
	
	$('.views-field-field-project-thumb-fid').hover(function(){
		if($.browser.webkit){
	    $(this).find('.subtitle').stop().animate({height: $(this).find('.subtitle').data('h'), opacity: 0.97}, 350, 'easeOutExpo')
	  }else{
  	  $(this).find('.subtitle').stop().animate({height: $(this).find('.subtitle').data('h'), opacity: 0.95}, 200)
	  }
	  
	  $(this).parents('.pane-projects-main-page').mouseenter();
	  
	  return false;
	}, function() {
		if($.browser.webkit){
	    $(this).find('.subtitle').stop().animate({height:0, opacity: 0}, 500, 'easeOutExpo')
	  }else{
  	  $(this).find('.subtitle').stop().animate({height:0, opacity: 0}, 200)
	  }
	  
	  return false;	  
	} )

  /* 
  $('#scrollable-gallery-0 .view-content ul').jcarousel({scroll:1,wrap: "circular"});
  $('#scrollable-gallery-1 .view-content ul').jcarousel({scroll:1,wrap: "circular"});
  $('#scrollable-gallery-2 .view-content ul').jcarousel({scroll:1,wrap: "circular"});
  */
  $('.view-projects-main-page1 .item-list').each(function(){
    $(this).css('height', $(this).find('.jcarousel-list').height());
  })
  
  $('#projects-main-page1 .project-web').hover(function(){
    $('#projects-main-page1 .project-mag').removeClass('proj-hover')
    $('#scrollable-gallery-1').removeClass('proj-hover')
    $('#projects-main-page1 .project-logo').removeClass('proj-hover')
    $('#scrollable-gallery-2').removeClass('proj-hover')
    
    
    $('#scrollable-gallery-0').addClass('proj-hover')
  }, function(){
    $('#scrollable-gallery-0').removeClass('proj-hover')
    $(this).removeClass('proj-hover')
  })
  
   $('#scrollable-gallery-0').hover(function(){
    $('#projects-main-page1 .project-mag').removeClass('proj-hover')
    $('#scrollable-gallery-1').removeClass('proj-hover')
    $('#projects-main-page1 .project-logo').removeClass('proj-hover')
    $('#scrollable-gallery-2').removeClass('proj-hover')
    
    
    $('#projects-main-page1 .project-web').addClass('proj-hover')
  }, function(){
    $('#projects-main-page1 .project-web').removeClass('proj-hover')
  })
  
  
  
  $('#projects-main-page1 .project-mag').hover(function(){
    $('#projects-main-page1 .project-web').removeClass('proj-hover')
    $('#scrollable-gallery-0').removeClass('proj-hover')
    $('#projects-main-page1 .project-logo').removeClass('proj-hover')
    $('#scrollable-gallery-2').removeClass('proj-hover')
    
    
    $('#scrollable-gallery-1').addClass('proj-hover')
  }, function(){
    $('#scrollable-gallery-1').removeClass('proj-hover')
  })
  
   $('#scrollable-gallery-1').hover(function(){
    $('#projects-main-page1 .project-web').removeClass('proj-hover')
    $('#scrollable-gallery-0').removeClass('proj-hover')
    $('#projects-main-page1 .project-logo').removeClass('proj-hover')
    $('#scrollable-gallery-2').removeClass('proj-hover')
    
    
    $('#projects-main-page1 .project-mag').addClass('proj-hover')
  }, function(){
    $('#projects-main-page1 .project-mag').removeClass('proj-hover')
  })
  
  
  
  $('#projects-main-page1 .project-logo').hover(function(){
    $('#projects-main-page1 .project-web').removeClass('proj-hover')
    $('#scrollable-gallery-0').removeClass('proj-hover')
    $('#projects-main-page1 .project-mag').removeClass('proj-hover')
    $('#scrollable-gallery-12').removeClass('proj-hover')
    
    
    $('#scrollable-gallery-2').addClass('proj-hover')
  }, function(){
    $('#scrollable-gallery-2').removeClass('proj-hover')
  })
  
  $('#scrollable-gallery-2').hover(function(){
    $('#projects-main-page1 .project-web').removeClass('proj-hover')
    $('#scrollable-gallery-0').removeClass('proj-hover')
    $('#projects-main-page1 .project-mag').removeClass('proj-hover')
    $('#scrollable-gallery-12').removeClass('proj-hover')
    
    
    $('#projects-main-page1 .project-logo').addClass('proj-hover')
  }, function(){
    $('#projects-main-page1 .project-logo').removeClass('proj-hover')
  })
  
  /*$('.view-field-field-project-body').hide();
  
  $('.views-field-field-project-thumb-fid').mouseenter(function(){
    var parent = $(this).parent();

    parent.parent().stop(true, false).animate({"margin-top": "2px"},200, 'easeOutQuart').addClass('over-element');
    parent.children('.view-field-field-project-body').stop(true, true).slideDown(100);
  });
  $('.views-field-title').mouseenter(function(){
    var parent = $(this).parent();
    
    parent.parent().stop(true, false).animate({"margin-top": "2px"},200, 'easeOutQuart').addClass('over-element');
    parent.children('.view-field-field-project-body').stop(true, true).slideDown(100);
  });
  $('.view-projects-main-page .view-content .box').mouseleave(function(){
    var parent = $(this);
    
    parent.parent().stop(true, false).animate({"margin-top": "12px"},200, 'easeOutQuart', function(){
      $(this).removeClass('over-element');
    });
    $(this).children('.view-field-field-project-body').stop(true, true).slideUp(100);
  });
  $('.view-projects-main-page .views-field-field-project-thumb-fid').mouseleave(function(){
    var parent = $(this).parent();
    
    parent.parent().stop(true, false).animate({"margin-top": "12px"},200, 'easeOutQuart', function(){
      $(this).removeClass('over-element');
    });
    parent.children('.view-field-field-project-body').stop(true, true).slideUp(100);
  });*/
	
});

/*var sticky = false;
$(window).scroll(function(){   
   if($(window).scrollTop()>385){      
      var $services = $('.service-list.sticky')
      $services.css({'position':'fixed','top':0})      
      if($.browser.msie&&($.browser.version=='6.0'||$.browser.version=='7.0')){
         $services.css({'position':'absolute','top':$(window).scrollTop()-410});
      }      
      if(!sticky)$services.show();
      sticky = true;
   }else{
      $('.service-list.sticky').hide()
      sticky = false;
   }
})*/
//$('.service-list li h2').
