jQuery.noConflict();
(function($){

$(document).ready(function(){
						   
	if ($('#alert').length)
	{
		var off = $('#wrap').offset();
		var l = off.left + 919;
		$('#alert').css({ left: l + 'px' });
	}

	if ($('#menu3').length)
	{
		$('#menu3 li.sub > a').click(function(){
			var lia = $('#menu3 li.sub-active');
			lia.removeClass('sub-active').
				find('ul').slideToggle(400).end().
				find('> a').removeClass('active');
			if (lia[0] != this.parentNode)
			{
				$(this).addClass('active');
				$(this.parentNode).addClass('sub-active').find('ul').slideToggle(400);
			}
			return false;
		});
		$('#menu3 li.sub-active ul').show();
	}

	$('.tabControl').
		find('.tabs a').click(function(){
			var id = this.id.split('-')[1];
			$(this).parents('.tabs').find('a').removeClass('active');
			$(this).addClass('active');
			$(this).parents('.tabControl').find('.tab').hide();
			$('#' + id).show();
			return false;
		});
	
	if ($('#gallery').length)
	{
		function galleryGo(i){
			var li = $('#gallery li').filter('.active');
			var next = li[(i>0 ? 'next' : 'prev')]();
			if (!next.length)
			{
				if (i > 0)
					next = $('#gallery li:first');
				else
					next = $('#gallery li:last');
			}
			li.removeClass('active');
			next.addClass('active');
		}
		$('#gallery').
			find('p.prev a').click(function(){
				galleryGo(-1);
				return false;
			}).end().
			find('p.next a').click(function(){
				galleryGo(1);
				return false;
			}).end().
			find('li .img a').lightBox({
			});
	}

	if ($('#product1').length)
	{
		$('#product1 .imgs a').lightBox({});
	}


if ($('#photo-frame').length)
	{
		$('#photo-frame .photo-frame-thumb a').lightBox({});
	}


	var timerResize = null;

	function fixHeight(){
		var w = $('#wrap');
		var h = $(window).height()
		h -= $('#top').height() + $('#footer').height();
		w.css({ minHeight: h + 'px' });
		if ($.browser.msie && ($.browser.version <= 6))
			w.css({ height: h + 'px' });
		timerResize = null;
	}

	$(window).resize(function(){
		if (!timerResize) {
			timerResize = setTimeout(fixHeight, 150);
		}
	});
	fixHeight();


	if ($.browser.msie) {
		try {document.execCommand("BackgroundImageCache", false, true);} catch(err){};
		if (typeof(DD_belatedPNG) != 'undefined')
		{
			DD_belatedPNG.fix('#wrap,#page, #footer, .butDonate a, .butSignup a, .butThings a, .tabs a, .more a, #title1 h3, #menu3 a, #search div, .contact a');
			DD_belatedPNG.fix('#donate1 .read a, #donate1 .box, .cart, #shopListing .img, .butMoreInfo a, .butBuyNow a, #product1 .imgs a');
			DD_belatedPNG.fix('#cart1 h3, .butCheckout2 a, #checkout1 input.submit, #login1 input.submit, .butLogout a, #things a em, .slide-screen,.watch-top');
			DD_belatedPNG.fix('a.f-btn-link,a:hover.f-btn-link,a.f-event-link-1,a:hover.f-event-link-1,a.f-event-link-2,a:hover.f-event-link-2,a.f-event-link-3,a:hover.f-event-link-3,div.close,');
		}
	}


});

})(jQuery);
