// the Jquery Code

jQuery(document).ready(function($) {


	// Portfolio items overlay slide effect
	var lis = $("#rt-feature .pt_item");
	lis.hover(
	  function () {
		$(this).find('.description-overlay').animate({top:'20px'}, 300, 'easeOutExpo');
	  },
	  function () {
		$(this).find('.description-overlay').animate({top:'140px'}, 200, 'easeOutExpo');
	  }
	);
	
	// init infield labels
	$("#formAcymailing1 label, .search label, #contact_form label").inFieldLabels();
	
	// add a plus to the services & clients lists
	$('.plus_list ul li, #rt-sidebar-a ul.menu li, #rt-sidebar-b ul.menu li, #rt-sidebar-c ul.menu li').prepend("<span>+</span>");
	
	// FAQ Code
	$('.item-pagefaq h3').each(function() {
		var tis = $(this), state = false, answer = tis.next('div').hide().css('height','auto').slideUp();
		tis.prepend("<span>+</span> ")
		tis.click(function() {
		  state = !state;
		  answer.slideToggle(state);
		  tis.toggleClass('active',state);
		  if(tis.hasClass('active')) {
			  tis.find('span').text('→');
		  } else {
			  tis.find('span').text('+');
		  }
		});
	}); // end each faqs
	
	// portfolio item animation
	
	// add a last class to the 3rd item from each row
	//$("#portfolio-content-content .portfolio-item:nth-child(3n)").addClass("last");
	
	var portfolio_items = $(".portfolio-item");
	var portfolio_items_height = $(".portfolio-item").css("height");

	portfolio_items.each(function(el){
		$(this).find(".description-overlay").css({"height":portfolio_items_height,"top":portfolio_items_height});
	})
	
	portfolio_items.hover(
	  function () {
		$(this).find(".description-overlay").animate({top:0}, 300, "easeOutExpo");
	  },
	  function () {
		$(this).find(".description-overlay").animate({top: portfolio_items_height}, 200, "easeOutExpo");
	  }
	);
	var tab_wrapper = $('.gkTab');
	if(tab_wrapper.prev().hasClass('title')) {
		tab_wrapper.addClass('hasTitle');
	}
	
});

