

$(document).ready(function() {
		
	if ($.browser.msie  && parseInt($.browser.version) == 7) {
	var zIndexNumber = 1000;
	$('.adventCalendarModule li').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	})
	}
	
	var clearMePrevious = '';
	// clear input on focus
	$('.competitionForm input').focus(function() {
		if($(this).val()==$(this).attr('title')) {
			clearMePrevious = $(this).val();
			$(this).val('');
		}
	});
	
	// if field is empty afterward, add text again
	$('.competitionForm input').blur(function() {
		if($(this).val()==''){
			$(this).val(clearMePrevious);
		}
	});

			   
						   
    $('a[href^="http://"]').attr("target", "_blank");
	$('#recipeSubNav .recipeSubNavContent a[href^="http://"]').attr("target","_self");
	$('a[href^="http://customerrecipes"]').attr("target", "_self");
	$('a[href^="http://www.tescorealfoodchallenge"]').attr("target", "_self");
	
	$('.relatedPanel .panelHeader').siblings().children().hide();
	$('.relatedPanel .panelHeader').next().children().show();

	$('#relRecipes a').click(function(){
		$('#relatedNav li a').removeClass('active');
		$(this).addClass('active');
		$('.relatedPanel .panelContent').hide();
		$('#relRecipesPanel').show()
	})
	
	$('#relCookingTips a').click(function(){
		$('#relatedNav li a').removeClass('active');
		$(this).addClass('active');
		$('.relatedPanel .panelContent').hide();
		$('#relCookingTipsPanel').show()
	})
	
	$('#relArticles a').click(function(){
		$('#relatedNav li a').removeClass('active');
		$(this).addClass('active');
		$('.relatedPanel .panelContent').hide();
		$('#relArticlesPanel').show()
	})
	
	
	
	$('#recipeNav').mouseover(function(){
		$('#recipeSubNav').show();
		$('.navRecipes').addClass('activeRecipeSub');
	})
	
	$('#recipeNav').mouseout(function(){
		$('#recipeSubNav').hide();
		$('.navRecipes').removeClass('activeRecipeSub');
	})
	
	$('#ourFoodNav').mouseover(function(){
		$('#ourFoodSubNav').show();
		$('.navOurFood').addClass('activeOurFoodSub');
	})
	
	$('#ourFoodNav').mouseout(function(){
		$('#ourFoodSubNav').hide();
		$('.navOurFood').removeClass('activeOurFoodSub');
	})
	
	$('.windowsMenu').mouseover(function(){
		$('.windowsMenu').addClass('active');	
	})
	
	
	$('.windowsMenu').mouseout(function(){
		$('.windowsMenu').removeClass('active');	
	})
	
	$('body').addClass('jsEnabled');
	
	
});
