$j(document).ready(function() {
	
	// ----------------------- FEATURED CONTENT
	$j('.jive-widget-featuredcontentwidget').wrapAll('<div class="jive-box multi-features"></div>');
	$j('.jive-widget-featuredcontentwidget .jive-widget-header:first').css('display','block');
	// limit featured content to only one per space
	// $j(".jive-widget-featuredcontentwidget").find("tr:gt(1) td").remove();
	// zebra stripes
	$j(".multi-features tbody tr:odd td").css("background","#EEEDED");
	
	// ----------------------- FIX IE
	if($j('body').hasClass('ie')) {
	
		// - Z-INDEX BUG
		var zIndexNumber = 1000;
		$j('#homeShadow div').each(function() {
			$j(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 1;
		});
		
	};
	
	// ----------------------- OPEN EXTERNAL LINKS IN A NEW WINDOW
	$j("a[href^='http:']:not([href*='" + window.location.host + "'])")
		.not("[href^=#]")
		.not("[href*=playstation.com]")
		.attr("rel", "nofollow")
		.attr("target", "_blank");
	
	// ----------------------- [SONYPS-786] ADD NO FOLLOW TO: user profiles, tags, and Report Abuse links
	$j("a[href*='/people'], a[href*='tags'], a[href*='/message-abuse']").each(function(){
		var url = $j(this).attr("href");
		// make sure it's an internal link
		if(url.indexOf("http://" + window.location.host) >= 0 || url.substring(0,1) == "/") {
			$j(this).attr("rel", "nofollow");
		};
	});
	
	// ----------------------- Make actions widget consistent
	$j("#jive-action-sidebar-tab-header_community-notifications-tab").parent().addClass("notifications");
	
	// ----------------------- .ps-button arrows
	$j('.ps-button').append('<span class="arrow" />');
	
	// ----------------------- Navigation/Login iframe width
	$j('#navigation').hover(
		function(){
			$j(this).addClass('ps-navigation-hover');
			$j(this).children('iframe').attr({
				scrolling: 'no',
				width: '300',
				height: '900'
			});
		},
		function(){
			$j(this).removeClass('ps-navigation-hover');
			if($j('body').hasClass('ie')) {
				$j(this).children('iframe').attr({
					scrolling: 'no',
					width: '147',
					height: '400'
				});
			};
		}
	);
	
	// Login width
	$j('#profile').hover(
		function(){
			$j(this).addClass('ps-login-hover');
			$j(this).children('iframe').attr({
				scrolling: 'no',
				width: '500',
				height: '500'
			});
		},
		function(){
			$j(this).removeClass('ps-login-hover');
			if($j('body').hasClass('ie')) {
				$j(this).children('iframe').attr({
					scrolling: 'no',
					width: '500',
					height: '120'
				});
			};
		}
	);
	
});
