jQuery.noConflict();
(function($){

$(document).ready(function(){

	var ie6 = ($.browser.msie && ($.browser.version <= 6));

	if (!ie6)
	{
		$(document.body).addClass('js');

		$('#menu li:not(.active) a').each(function(){
			var $sp = $('span', this).css('opacity', 0).show();
			$(this).hover(function(){
				$sp.stop().fadeTo(400, 1);
			}, function(){
				$sp.stop().fadeTo(400, 0);
			});
		});
	}

	if ($('#portfolio').length)
	{
		$('#portfolio li').css({ zIndex: 1 }).hide().filter(':eq(0)').show();
		setInterval(function(){
			var li = $('#portfolio li:visible');
			var sb = li.next();
			if (!sb.length)
				sb = $('#portfolio li:eq(0)');
			li.css({ zIndex: 1 });
			sb.css({ zIndex: 2 }).fadeIn();
			li.fadeOut();
		}, 4000);
	}

	if ($('#websites').length && $.fn.fancybox)
	{
		$('#websites ul.images a').fancybox({
			padding: 0,
			zoomOpacity: true,
			zoomSpeedIn: 300,
			zoomSpeedOut: 200,
			overlayShow: !ie6,
			overlayOpacity: 0.6,
			centerOnScroll: false
		});
	}

	if ($('#feature').length)
	{
		$('#feature .slider').jCarouselLite({
			btnPrev: '#feature p.prev a',
			btnNext: '#feature p.next a',
			auto: 10000,
			speed: 600,
			circular: true,
			visible: 1
		});
	}
	if ($('#services').length)
	{
		$('#services .tabs a').click(function(){
			$('#services .tabs li').removeClass('active');
			$(this).parents('li:eq(0)').addClass('active');
			return false;
		}).filter(':eq(0)').click();
		$('#services .slider').jCarouselLite({
			btnGo: ['#tab-tab1', '#tab-tab2', '#tab-tab3', '#tab-tab4'],
			speed: 400,
			circular: false,
			visible: 1
		});
	}
	
	if ($.browser.msie) {
		try {document.execCommand("BackgroundImageCache", false, true);} catch(err){};
		if (typeof(DD_belatedPNG) != 'undefined')
		{
			PNG.fix('#body, #action p a, #logo, #menu a, #menu2, #menu2 li a, #contact, #contact input.submit, #portfolio, #portfolio img, #feature li, #feature p.buttons a, #boxes div');
		}
	}

});

})(jQuery);
