jQuery.noConflict();
(function($){

$(document).ready(function(){

//	$('#gallery li a').hover(function(){
//		var i = $('img', this)[0];
//		var r = this.rel;
//		this.rel = i.src;
//		i.src = r;
//	}, function(){
//		var i = $('img', this)[0];
//		var r = this.rel;
//		this.rel = i.src;
//		i.src = r;
//	});

	if ($.fn.jCarouselLite)
	{
		var i = 1;
		$('#slideshow .slider li').each(function(){
			this.className = 'index-' + (i++);
		});
		var n = i - 1;
		$('#slideshow .slider').jCarouselLite({
			btnPrev: '#slideshow a.prev',
			btnNext: '#slideshow a.next',
			visible: 1,
			scroll: 1,
			speed: 2300,
			auto: true,
			circular: true,
			afterEnd: function(li){
				var i = parseInt(li[0].className.split('-')[1]);
				$('#slideshow a.prev')[((i == 1) ? 'addClass' : 'removeClass')]('inactive');
				$('#slideshow a.next')[((i == n) ? 'addClass' : 'removeClass')]('inactive');
			}
		});
		$('#slideshow a.prev').addClass('inactive');
	}

	if ($.browser.msie) {
		try {document.execCommand("BackgroundImageCache", false, true);} catch(err){};
		if (typeof(DD_belatedPNG) != 'undefined')
		{
			DD_belatedPNG.fix('img, #logo a, #wrapT, #wrapB, #wrap, .box2, .all a, #slideshow .bar, #slideshow .other a');
		}
	}
	
	var tMenu = null;
	$('#header2 #menu a.icon').hover(function(){
		if (tMenu)
		{
			clearTimeout(tMenu);
			tMenu = null;
		}
		$(this).parents('ul').find('li').removeClass('hover');
		$(this).parents('li').addClass('hover');
	}, function(){
		var li = $(this).parents('li');
		tMenu = setTimeout(function(){
			li.removeClass('hover');
		}, 250);
	});
	$('#menu li div').hover(function(){
		if (tMenu)
		{
			clearTimeout(tMenu);
			tMenu = null;
		}
	}, function(){
		var li = $(this).parents('li');
		tMenu = setTimeout(function(){
			li.removeClass('hover');
		}, 250);
	});

	$('.tabs1 .tabs a').click(function(){
		var s = $(this);
		s.parents('ul').find('li').removeClass('active');
		s.parent().addClass('active');
		s.parents('.tabsArea').find('.tab').hide();
		$('#tab-' + this.id).show();
		return false;
	});

	if ($.browser.msie) {
		try {document.execCommand("BackgroundImageCache", false, true);} catch(err){};
		if (typeof(DD_belatedPNG) != 'undefined')
		{
			DD_belatedPNG.fix('img, #logo a, #header2, #wrap, #footer, #motto1, #menu a.icon, #menu li div');
			DD_belatedPNG.fix('#header3, #header3 .img, #header3 li li');
		}
	}

});

})(jQuery);
