var minHeight = 740;
var nxAd = $.flash.create({swf:"http://nxcache.nexon.net/nx/global/nxad_external/nxad_unit_right.swf",width:120,height:600,params:{wmode:"transparent", bgcolor:"#FFFFFF", allowScriptAccess:"always"}});
var bpTeaser = $.flash.create({swf:"http://nxcache.nexon.net/blockparty/teardown/BP_Teaser.swf",width:200,height:31,params:{wmode:"transparent",bgcolor:"#FFFFFF",allowScriptAccess:"always"}});
var bpSlideshow = $.flash.create({swf:"http://nxcache.nexon.net/blockparty/teardown/BP_Slideshow.swf",width:800,height:600,params:{wmode:"transparent",bgcolor:"#FFFFFF",allowScriptAccess:"always"}});
function setGameInfo(){
	$('.game_icon img').each(function(){ // set alt and title attributes on spotlight game icons
		var gameIconURL = $(this).attr("src");
		var gameIcon = getTitle(gameIconURL.slice((gameIconURL.indexOf("icon_")+5),(gameIconURL.indexOf('.gif'))));
		$(this).attr({title:gameIcon,alt:gameIcon});
	});
}
function getTitle(g) {
	switch(g){
		case 'ca':return "Combat Arms";
		case 'ms':return "MapleStory";
		case 'mb':return "Mabinogi";
		case 'nx':return "Nexon";
		case 'df':return "Dungeon Fighter Online";
		case 'cg':return "iTCG Online";
		default:return "Icon";
	}
}
// google analytics code
function gaLoad(gaId) {
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	$.ajax({
		url:gaJsHost + "google-analytics.com/ga.js",
		complete: function(){
			try {
				pageTracker = _gat._getTracker(gaId);
				pageTracker._initData();
				pageTracker._trackPageview();
			} catch(err) {}
		},
		dataType:"script" 
    });
}
function trackCloseSlideshow(){
	if (typeof pageTracker != "undefined")
		pageTracker._trackEvent("bpTeaser", "CloseSlideshow");
}
function trackReplaySlideshow(){
	if (typeof pageTracker != "undefined")
		pageTracker._trackEvent("bpTeaser", "ReplaySlideshow");
}
function revealTeardown(){
	if (typeof pageTracker != "undefined")
		pageTracker._trackEvent("bpTeaser", "Open");
	$("#bpTeaser").css({top:"22px",marginLeft:"40px"}).html(bpSlideshow);
}
function removeTeardown(){
	if (typeof pageTracker != "undefined")
		pageTracker._trackEvent("bpTeaser","Close");
	$("#bpTeaser").css({top:"21px",marginLeft:"340px"}).html(bpTeaser);
}
$(function(){
	$('#FreeToPlay').jqm(); // free to play modal
	// sets jq cycle
	$('.answer_two').hide();
	$('.answer_three').hide();
	$('.question_one').click(function(){
		$('.answer_one').slideToggle(100);
		$('.answer_two').slideUp(100);
		$('.answer_three').slideUp(100);
	});
	$('.question_two').click(function(){
		$('.answer_one').slideUp(100);
		$('.answer_two').slideToggle(100);
		$('.answer_three').slideUp(100);
	});
	$('.question_three').click(function(){
		$('.answer_one').slideUp(100);
		$('.answer_two').slideUp(100);
		$('.answer_three').slideToggle(100);
	});
	//end set jq cycle
	setGameInfo();
	$("#bpTeaser").css({position:"absolute",zIndex:"2000"});
	removeTeardown();
	gaLoad("UA-1376772-2");
});