jQuery(function($) {
	var $ = jQuery;


/*------------------------------------*\
  SERVICES BOX
\*------------------------------------*/
  $('.servicebox-hover').css({ opacity: 0 });  
  $('.servicebox-hover').mouseenter(function() {

    $(this).find($('li')).css({ opacity: 0});
    $(this).css({ opacity: 1 });
      $(this).find($('li')).each(function(index) {
        tweenTime = index * 50 + 200;
        delayTime = index * 250;
          $(this).delay(delayTime).animate({opacity: 1}, {queue: false, duration:tweenTime, easing:"easeInQuint"});
        });
  });
  
  $('.servicebox-hover').mouseleave(function() {
    $(this).animate({ opacity: 0 }, {duration:150, easing:"easeOutQuad"});
  });
/*------------------------------------*\
	NAVIGATION
\*------------------------------------*/	
$(" .nav ul ul").css({display: "none"}); // Opera Fix
$(" .nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});


/*------------------------------------*\
	jQuery UI
\*------------------------------------*/	
	// Tabs	
	//$(".tabs").tabs();
	
	
	// Toggles	
	$('.toggle-view li').click(function () {
		var text = $(this).children('p');
		
		if (text.is(':hidden')) {
			text.slideDown('fast');
			$(this).children('h4').addClass('active');		
		} else {
			text.slideUp('fast');
			$(this).children('h4').removeClass('active');		
		}		
	});


/*------------------------------------*\
	Image hover effect
\*------------------------------------*/
 	
	// Over field	
	$('.over').stop().animate({ "opacity": 0 }, 0);
 	function over() {
		$('.over').hover(function() {
			$(this).stop().animate({ "opacity": .8 }, 250);
		}, function() {
			$(this).stop().animate({ "opacity": 0 }, 250);
		});	
	}	
	over();
	
	// Firefox fix	
	if (window.addEventListener) { 
        window.addEventListener('unload', function() {}, false); 
	} 	
	
	// Opacity change on hover	
	function hover_opacity() {
		$('.portfolio img,.content .gallery, .search_submit').hover(function() {
			$(this).stop().animate({ "opacity": .5 }, 300);
		}, function() {
			$(this).stop().animate({ "opacity": 1 }, 300);
		});
	}	
	hover_opacity();

	
/*
 * ---------------------------------------------------------------- 
 *  Colorbox
 * ----------------------------------------------------------------  
 */
	function colorbox() {
		$(".colorbox").colorbox();
		$(".cbox_media").colorbox({iframe:true, innerWidth:853, innerHeight:500});
	}
	colorbox();	

	
});
