$(document).ready(function(){
	$('.slide-down').hide();
	$('.contact-box').css('position','relative');
	$('.contact-inner').css('height','64px');
	// reset all tabs on start
	$('ul.tabset').find('a.tab').each(function(){
		if($(this).is('.active')){
			$($(this).attr('href')).show();
		} else {
			$($(this).attr('href')).hide();
		}
	});
	$('ul.tabset').find('a.tab').click(function(){
		$(this).parent().parent().find('a.tab').each(function(){
			$(this).removeClass('active');
			$($(this).attr('href')).hide();
		});
		$(this).addClass('active');
		$($(this).attr('href')).show();
		return false;
	});
	$('a.submit-case').click(function(){
		$('.slide-down').slideToggle();
		$(this).toggleClass('active');
	});
	var _close = true;
	var _over = false;
	$('.side-contact input, .side-contact textarea, .side-contact select').focus(function(){
		_close = false;
	});
	$('.side-contact input, .side-contact textarea, .side-contact select').blur(function(){
		_close = true;
		if (!_over) $('.contact-inner').animate({height: 64 + "px"}, { duration: 400, queue:false });
	})
	$('.side-contact').hover(
		function () {
			_over = true;
			$('.contact-inner').animate({height: 228 + "px"}, { duration: 400, queue:false });
		}, 
		function () {
			_over = false;
			if (_close)
				$('.contact-inner').animate({height: 64 + "px"}, { duration: 400, queue:false });
		}
    );
	$('.gallery').cycle({ 
		speed:       		600, 
		timeout:     		0, 
		pagerEvent: 		'mouseover',
		pauseOnPagerHover:	true, 
		pause:		   	true,
		next:		   	'.scroll-right',
		prev:			'.scroll-left'
	});
});