function hotswap (source,name) {    name.src=source;	}

 var spotlightTimer = null;
 var spotlightQueue = [];
 var spotlighCurrentIndex = 0;
   
 function showSpotlightInit(){
	$("div[id*='modfull_']").each(function(i){
		$(this).css('z-index',1);
	});

	$('#slarrow_1').css('visibility','visible');
	$('#element_1').addClass('division-box-c');
	$('#element_1').fadeIn('normal');
 	$('#modfull_1').fadeIn('normal');
 	
 	$("div[id*='modfull_']").each(function(){
		var arr = $(this).attr('id').split('_');
		if(!arr || !arr.length || arr.length!=2){
			return;
		}
		var mod_id = parseInt(arr[1]);
		spotlightQueue.push(mod_id);
	});
 	
	spotlightTimer = setInterval('showSpotlightAnimate()',2500);
 }
 
 function showSpotlightAnimate(){
 	if(spotlightQueue && spotlightQueue.length>0){
 		if(spotlighCurrentIndex>(spotlightQueue.length-1)){
 			spotlighCurrentIndex = 0;
 			showSpotlightSwap(spotlightQueue[spotlighCurrentIndex]);
 			clearInterval(spotlightTimer);
 			return;
 		}
 		showSpotlightSwap(spotlightQueue[spotlighCurrentIndex]);
 		//update interval
 		if(spotlighCurrentIndex==0){
 			clearInterval(spotlightTimer);
 			spotlightTimer = setInterval('showSpotlightAnimate()',5000);
 		}
 		spotlighCurrentIndex++;
 		}
 }
 
 function showSpotlightSwap(mod_id){
	if(!mod_id){
		return;
	}
	var total_blocks = 6;
	$('#element_' + mod_id).addClass('division-box-c');
	$('#modfull_' + mod_id).fadeIn('normal');
	$('#slarrow_' + mod_id).css('visibility','visible');
	for(var i=1;i<=total_blocks;i++){
		if(i==mod_id){
			continue;
		}
		$('#modfull_' + i).fadeOut('normal');
		$('#slarrow_' + i).css('visibility','hidden');
		$('#element_' + i).removeClass('division-box-c');
	}
 }
 
 function showSpotlightControl(){
	 try{
	 	showSpotlightInit();
	 	$("div[id*='element_']").click(
	 		function(){
				//alert('clicked');
				clearInterval(spotlightTimer);
				var arr = $(this).attr('id').split('_');
				if(!arr || !arr.length || arr.length!=2){
					return;
				}
				var id = parseInt(arr[1]);
				showSpotlightSwap(id);
			}
	 	);
	 }
	 catch(e){
	}
 }
