function shoutoutImageCount(str){
	switch(str){
		case "CA": return 5; // NUMBER OF COMBATARMS SHOUTOUTS
		case "MB": return 5; // NUMBER OF MABINOGI SHOUTOUTS
		case "MS": return 5; // NUMBER OF MAPLESTORY SHOUTOUTS
		case "DF": return 6; // NUMBER OF DUNGEON FIGHTER SHOUTOUTS
		case "CG": return 5; // NUMBER OF iTCG SHOUTOUTS
		default: case "NX": return 0;  // NUMBER OF NEXON ( DEFAULT ) SHOUTOUTS
	}
}
function shoutoutMagic(imgSrcStr){
	var s = imgSrcStr.slice(-6,-4);
	var c = shoutoutImageCount(s);
	var rnd = (Math.floor(Math.random()*c)+1) ;
	var ImgUrl = "http://nxcache.nexon.net/nx/main_page/shout_outs/"; //default path for shoutout images
	ImgUrl += "shoutout_" + s + "_" +(rnd < 10 ? "0" + rnd : rnd) + ".gif";
	return ImgUrl;
}
function onChange(){
	$('#Shoutout').attr("src",shoutoutMagic($(this).find("img").attr("src")));
}
$(function() {
	$('#EventSlideshow').cycle({
		fx:'fade',//the type of effect you want. you can do slide, shrink, a whole bunch of cheesy effects. See http://malsup.com/jquery/cycle for more
		speed: 'fast',//the speed between the transitions, you can specify a number here
		timeout:  5000,//how long each slide lasts, in milliseonds, before it goes to next one
		next: '.next_slide',//assign a next button to an HTML element with the class of .next_slide
		prev: '.previous_slide',//assign a previous button to an HTML element with the class of .prev_slide
		pager:   '#NavigateSlideshow',//assign a div to handle the numeration of the slides
		after: onChange, //trigger the shoutout
		pagerAnchorBuilder: function(i) {return '<li><a href="#">'+(i+1)+'</a></li>';}//dynamically create a set of LI elements based on the number of slide images
	});
	$('.slide_control').toggle(function(){ //when you click on an HTML element with the class of .slide_control,
		$('#EventSlideshow').cycle('pause');//pause the slideshow,
		$('.slide_control').css("background-position","100% 0%");//and shift the image to display a PLAY button
		},function(){//now that this has been clicked, assign a function to enable to play it again
		$('#EventSlideshow').cycle('resume', true);//when clicked, go to next slide and start automatic slidesow
		$('.slide_control').css("background-position","0% 0%");//and shift back the image to display the PAUSE button
	});
	$('#EventContentHeader').corner('8px');//round the edges of the container div (optional, based on designer discretion)
	$('#EventSlideshow').add("#NavigateSlideshow").show();
});