jQuery.noConflict();
(function($){

$(document).ready(function(){
	var stopAutoHide = false;

	if ($.prettyPhoto)
	{
		$(".gallery a, a[rel='gallery'], .video a").prettyPhoto({ theme: 'facebook' });
	}


	var p = $('#box1 .popup'), h = p.height();

	p.click(function(){
		var s = $(this), h = s.height() - 45;
		stopAutoHide = true;
		if (s.hasClass('active'))
		{
			s.animate({ bottom: '-' + h + 'px' }, 300);
		}
		else
		{
			s.animate({ bottom: '0px' }, 300);
		}
		s.toggleClass('active');
	});
	
	var titleHeight = $('.popup .body .title2').height()+10;
	var imgHeight = 0;
	if($('.popup .body .img').length > 0){
		var imgHeight = $('.popup .body .img').height() + 10;
	}
	var animateHeight = titleHeight + imgHeight + 45;
	
	//p.css({ bottom: '-' + h + 'px' }).animate({ bottom: '-' + (h - 155) + 'px' }, 300);
	p.css({ bottom: '-' + h + 'px' }).animate({ bottom: '-' + (h - animateHeight) + 'px' }, 300);

	setTimeout(function(){
		if(!stopAutoHide){
			p.animate({ bottom: '-' + (h - 45) + 'px' }, 300);
		}
	}, 3000);

	if ($.browser.msie) {
		try {document.execCommand("BackgroundImageCache", false, true);} catch(err){};
		if (typeof(DD_belatedPNG) != 'undefined')
		{
			DD_belatedPNG.fix('img, #menu2 a span, .popup .title, .popup .body');
		}
	}

});

})(jQuery);