if($.browser.msie && $.browser.version.substr(0,1) == 6) {
	DD_belatedPNG.fix('#logo a, #head, .nav-l, .nav-r, .nav-c, #header .top, #navigation, .main-t, .main-b, .main-c, .btn-more, .weather, .weather h2 img, .specials a img, #slider .nivo-caption, #slider .nivo-controlNav, #slider .nivo-prevNav, #slider .nivo-nextNav, #navigation ul li.first a span, #navigation ul li.last a span, #signup .field, #signup .button, #newsletter');
}

$(window).load(function () {
	var total = 0;
	$('.nav-c > ul > li').each(function (index) {
		total += $(this).width();
	});
	total = $('#navigation').width() - 28 - total;
	total = total / ($('.nav-c > ul > li').length * 2);
	$('.nav-c > ul > li > a').css({padding: '0 '+total+'px'});
	
	var remaining = $('#navigation').width() - ($('.nav-c').width()+28);
	
	if (remaining > 5) {
		$('.nav-c > ul > li.last a').css({paddingRight: total+(remaining-5)});
	}
	
	
});

$(function(){
	// slider
	$('#slider').nivoSlider({
		prevText: '',
		nextText: '',
		captionOpacity: 1,
		directionNavHide: false,
		pauseTime: 4000,
		afterLoad: function () {
			$('#slider .nivo-controlNav a').html('');
		}
	});
	
	// navigation
	$('.nav-c > ul > li').hover(function() {
		if ($(this).has('ul').length > 0) {
			$('#navigation').addClass('nav-h');
		} else {
			$('#navigation').removeClass('nav-h');
		}
		$(this).css({ 'z-index' : 100 });
		$(this).find('> ul').show(200);
		$(this).find('a:eq(0)').addClass('hover');
	}, function() {
		$(this).css({ 'z-index' : 1 });
		$(this).find('> ul').hide();
		$(this).find('a:eq(0)').removeClass('hover');
		$('#navigation').removeClass('nav-h');
	});
	
	
	
	// newsletter
	var visible = false;
	$('#btn-trigger').click(function () {
		$('#newsletter').animate({right: visible ? -275 : -50}, 400, 'easeOutBack', function () {
			visible = !visible;
		});
		return false;
	});
	$('#newsletter').hover(function () {
		
	}, function () {
		$('#newsletter').animate({right: -275}, 400, 'easeOutBack', function () {
			visible = false;
		});
	});
	
	// fields
	$('.blink')
		.focus(function(){
			if( $(this).val() == $(this).attr('title') ) {
				$(this).val('');
			}
		})
		.blur(function(){
			if( $(this).val() == '' ) {
				$(this).val( $(this).attr('title') );
			}
		});
});
