$(function(){
	//replaces body class
	$('body').removeClass('js-disabled').addClass('js-enabled');

	$('a.thickbox').each(function()	{
		href = $(this).attr('href');
		// *************
		
		// *************
		$(this).attr('href', href.replace(/\?/, "?js=yes&"));
	});
	
	// png fix init /* COMMON */
	if ($.browser.msie && $.browser.version<7) {
		$.ifixpng.pixel = '/magazine/graphics/pixel.gif';
		$('img[@src$=.png],input[@src$=.png]').not('.nofix').ifixpng();
	}

	//jobs, community, resources blocks
	$('#home .option .close').click(function(){$(this).parents('.option').css('left','-9999px').end(); return false;});
	$('#home .blockone a.quickSearch,  #home .blockone .start').click(function(){$(this).parents('#content').find('.quicksearch').css('left','36px').siblings('.option:visible').css('left','-9999px').end(); return false;});
	$('#home .blocktwo a.browseStaffroom, #home .blocktwo .start').click(function(){$(this).parents('#content').find('.browse_staffroom').slideDown().css('left','357px').siblings('.option:visible').css('left','-9999px').end(); return false;});
	$('#home .blockthree a.quickSearch, #home .blockthree .start').click(function(){$(this).parents('#content').find('.resourcequicksearch').slideDown().css('left','675px').siblings('.option:visible').css('left','-9999px').end(); return false;});

	// closes panels
	$('#home .option h2').click(function() {$(this).siblings('a.close').trigger('click');});

	// sets focus states for input fields
	$('#main input, #main textarea, .sendtoFriend input, .sendtoFriend textarea').focus(function(){
		$(this).css({backgroundColor:'#ffffb7', color:'#000', borderColor:'#000'});
		}).blur(function() {
		$(this).css({backgroundColor:'#fff', color:'#959595', borderColor:'#bfbfbf'});
	});

	// myhome tabs
	$('#home .hometabsContainer .tc2').hide();
	$('.testabs li a',this).click(function(){
	$(this).parent().addClass('on').siblings('li').removeClass('on').parents('.testabs').siblings('.tc2').show().siblings('.tc1').hide();
	return false;
	});
	$('.testabs li.on a',this).click(function(){
	$(this).parent().addClass('on').siblings('li').removeClass('on').parents('.testabs').siblings('.tc1').show().siblings('.tc2').hide();
	return false;
	});

	// avatar popup functionality
	$('div.avatar').hover(function(){
		$(this).addClass('over').children('.avatar_options').show();
	},function(){
		$(this).removeClass('over').children('.avatar_options').hide();
	});

	$('input.text[title]').setFormInstructions();
});
