function init() {

}


function showPlayOverlays(containerDiv) {
	var parentDiv = new Array();
	var playThumbsArray = new Array();
	playThumbsArray = $(containerDiv).select('div.playThumb');
	for (i=0;i<playThumbsArray.length;i++) {
		if (playThumbsArray[i].select('a')[0]) {
			parentDiv[i] = playThumbsArray[i].up();
			parentDiv[i].observe('click', respondToClick)
		}
	}
}

function respondToClick(event) {
	parent.location.href = this.select('a')[0].readAttribute('href')
}


/* Use this to display the up sell overlay ... if the user selected do not show this or user already registered then this will not display. */
function displayUpSell()
{
	if (typeof(jQuery.cookie('do_not_show_upsell')) == 'object') // the cookie does not exist yet
	{
		showUpSell = 0; // default to zero
	}
	else
	{
		showUpSell = parseInt(jQuery.cookie('do_not_show_upsell')); // get from the cookie
	}
		
	var regStatus = gameReg('7367'); // have you join the fame yet?
	
	//alert(regStatus +'::'+showUpSell)
	
	if (showUpSell != 1) // show the overlay to the user
	{
		if (regStatus != 1) // show the overlay to the user
		{			
			jQuery("input#do_not_show").removeAttr("checked"); // make sure the check is cleared
			jQuery('#upSaleBox').show('slow');
		}
		
		var temp = setTimeout("window.location = '#formCommentlink'", 2000);
	}
	else
	{
		//alert('no display')	
	}
}

/* Per Erik request, this function will set a cookie upon user click the i am a fan link */
function cookieFan(cookieID)
{
	jQuery.cookie(cookieID, 'favorited', {expires: 7});
}

function getQueryStr(formVar) {
	urlQuery = window.location.search.substring(1);
	
	gy = urlQuery.split("&");
	for (i=0;i<gy.length;i++) {
		ft = gy[i].split("=");
		if (ft[0] == formVar) {
		return ft[1];
		}
	}
}

function displayBadgeNotification()
{
	var now = (new Date()).valueOf();	
	var content = '';
	var badgeCount=0;
	var levelCount=0;
	
	jQuery.getJSON("/community/display/userAchievements.html?now=" + now, {season: '2010-06-30', cbsShowId: '5692', uname: jQuery.cookie('cbscomm_name')}, function(data) {
		jQuery.ajax({
			url: '/primetime/big_brother/notify/notification.php',
			success: function(data2) {
				jQuery('#notifyCenter').append(data2);
			
				if (typeof(data.badges) != 'undefined')
				{
					badgeCount = data.badges.length;
					
					for(i=0; i<badgeCount; i++)
					{
						content = content + '<div class="clear"></div>';
						content = content + '<div id="upSaleDesc2" class="upSaleDescBold">You\'ve unlocked: '+data.badges[i].title+'</div>';
						content = content + '<div id="badgesEarned"><img src="'+data.badges[i].photoUrl+'" border="0" /></div>';
					}
					
					//jQuery('#notifyWrapper').append(content);
					
					/*if (badgeCount > 0)
					{
						jQuery('#upSaleBox2').show('slow');	
					}*/
				}

				if (typeof(data.levels) != 'undefined')
				{
					levelCount = data.levels.length;
					
					for(i=0; i<levelCount; i++)
					{
						content = content + '<div class="clear"></div>';
						content = content + '<div class="upSaleDescBold levelTitle">You\'ve Leveled UP</div>';
						content = content + '<div class="upSaleDescBold blueColor">'+data.levels[i]+'</div>';
						content = content + '<div class="upSaleDescBold">In the Ultimate Fan Game</div>';
					}
					
					//jQuery('#notifyWrapper').append(content);
					
				}

				if (badgeCount > 0 || levelCount > 0)
				{
					content = content + '<div class="upSaleDescBold smallWord">Click here to see how you stack up!</div>';
					content = content + '<div class="centerMe"><img src="/primetime/big_brother/images/content/ultimate_fan/my_stats.png" border="0" /></div>';														
					
					jQuery('#notifyWrapper').append(content);
					jQuery('#upSaleBox2').show('slow');	
				}
			}
		});
	});
}


function closeBadgeNotify()
{
	var now = (new Date()).valueOf();	
	
	jQuery.getJSON("/community/display/userAchievements.html?now=" + now, {remove: 1, season: '2010-06-30', cbsShowId: '5692', uname: jQuery.cookie('cbscomm_name')}, function(data) 	{
		if (data.message == 'keys removed')
		{
			jQuery('#upSaleBox2').hide('slow');
		}
		else
		{
			alert('An error has occurred during your request.');	
		}
	
	});
	
	return false;
}
