
var i = 1; // 리더스 핫 클리닉 전역변수
var k = 1; // star 전역변수
var r = 1; // 리더스 칼럼 전역변수

function rolling(total_hot){ 
		
		//alert(i);
		if(i == 1){
			
			z=1;
			while(z <= total_hot){
				if(z != 1 && z != total_hot){	$('#test_'+ z).hide();	}
				z++;
			}

			$('#test_'+ total_hot).fadeOut(1500,function(){
				$('#test_'+ 1).fadeIn(1500);
			});

		}else if(i == 2){
			
			z=1;
			while(z <= total_hot){
				if(z != 1 && z != 2){	$('#test_'+ z).hide();	}
				z++;
			}

			$('#test_'+ 1).fadeOut(1500,function(){
				$('#test_'+ 2).fadeIn(1500);
			});

		}else if(i == 3){
			
			z=1;
			while(z <= total_hot){
				if(z != 2 && z != 3){	$('#test_'+ z).hide();	}
				z++;
			}

			$('#test_'+ 2).fadeOut(1500,function(){
				$('#test_'+ 3).fadeIn(1500);
			});

		}else if(i == 4){
			
			z=1;
			while(z <= total_hot){
				if(z != 3 && z != 4){	$('#test_'+ z).hide();	}
				z++;
			}

			$('#test_'+ 3).fadeOut(1500,function(){
				$('#test_'+ 4).fadeIn(1500);
			});

		}else if(i == 5){
			
			z=1;
			while(z <= total_hot){
				if(z != 4 && z != 5){	$('#test_'+ z).hide();	}
				z++;
			}
			
			$('#test_'+ 4).fadeOut(1500,function(){
				$('#test_'+ 5).fadeIn(1500);
			});

		}else if(i == 6){
			
			z=1;
			while(z <= total_hot){
				if(z != 5 && z != 6){	$('#test_'+ z).hide();	}
				z++;
			}

			$('#test_'+ 5).fadeOut(1500,function(){
				$('#test_'+ 6).fadeIn(1500);
			});

		
		}else if(i == 7){
			
			z=1;
			while(z <= total_hot){
				if(z != 6 && z != 7){	$('#test_'+ z).hide();	}
				z++;
			}
			
			$('#test_'+ 6).fadeOut(1500,function(){
				$('#test_'+ 7).fadeIn(1500);
			});

		
		}else if(i == 8){
			
			z=1;
			while(z <= total_hot){
				if(z != 7 && z != 8){	$('#test_'+ z).hide();	}
				z++;
			}

			$('#test_'+ 7).fadeOut(1500,function(){
				$('#test_'+ 8).fadeIn(1500);
			});

			
		}else if(i == 9){
			
			z=1;
			while(z <= total_hot){
				if(z != 8 && z != 9){	$('#test_'+ z).hide();	}
				z++;
			}

			$('#test_'+ 8).fadeOut(1500,function(){
				$('#test_'+ 9).fadeIn(1500);
			});

		
		}else if(i == 10){
			
			z=1;
			while(z <= total_hot){
				if(z != 9 && z != 10){	$('#test_'+ z).hide();	}
				z++;
			}			

			$('#test_'+ 9).fadeOut(1500,function(){
				$('#test_'+ 10).fadeIn(1500);
			});

		
		}else if(i == 11){
			
			z=1;
			while(z <= total_hot){
				if(z != 10 && z != 11){	$('#test_'+ z).hide();	}
				z++;
			}	
			
			$('#test_'+ 10).fadeOut(1500,function(){
				$('#test_'+ 11).fadeIn(1500);
			});

			
		}else if(i == 12){
			
			z=1;
			while(z <= total_hot){
				if(z != 11 && z != 12){	$('#test_'+ z).hide();	}
				z++;
			}	

			$('#test_'+ 11).fadeOut(1500,function(){
				$('#test_'+ 12).fadeIn(1500);
			});

		
		}else if(i == 13){
			
			z=1;
			while(z <= total_hot){
				if(z != 12 && z != 13){	$('#test_'+ z).hide();	}
				z++;
			}	
			
			$('#test_'+ 12).fadeOut(1500,function(){
				$('#test_'+ 13).fadeIn(1500);
			});

		
		}else if(i == 14){
			
			z=1;
			while(z <= total_hot){
				if(z != 13 && z != 14){	$('#test_'+ z).hide();	}
				z++;
			}	

			$('#test_'+ 13).fadeOut(1500,function(){
				$('#test_'+ 14).fadeIn(1500);
			});

			/*
			z=1;
			while(z <= total_hot){
				if(z != 13 && z != 14){	$('#test_'+ z).hide();	}
				z++;
			}
			*/

		}


		for(j=1; j <= total_hot; j++){
			
			if(i==j){
				$('#m_c_image_'+ j).attr('src','./img/circle_green'+j+'.gif');
			}else{
				$('#m_c_image_'+ j).attr('src','./img/circle_gray'+j+'.gif'); 
			}
		}
		
		i++;
		if(i > total_hot){ i=1;}

   setTimeout('rolling(total_hot)', 6000); 
} 

function rolling_star(){ 
    
	if(k <= 3){ 
		
		if(k == 1){
	
			$('#star_'+ 1).hide();
			$('#star_'+ 2).hide();
			
			$('#star_'+ 3).fadeOut(1500,function(){
				$('#star_'+ 1).fadeIn(1500);
			});

		}else if(k == 2){
			
			$('#star_'+ 2).hide();
			$('#star_'+ 3).hide();

			$('#star_'+ 1).fadeOut(1500,function(){
				$('#star_'+ 2).fadeIn(1500);
			});

		}else if(k == 3){
			
			$('#star_'+ 1).hide();
			$('#star_'+ 3).hide();

			$('#star_'+ 2).fadeOut(1500,function(){
				$('#star_'+ 3).fadeIn(1500);
			});

		}
		

		k++;	
		if(k > 3){
			k=1;
		}
	}//if 

   setTimeout('rolling_star()', 6500); 
} 

function rolling_column(){ 
    
	if(r <= 5){ 
		
		if(r == 1){
			
			$('#column_'+ 1).hide();
			$('#column_'+ 2).hide();
			$('#column_'+ 3).hide();
			$('#column_'+ 4).hide();
			$('#column_'+ 5).fadeOut(2500,function(){
				$('#column_'+ 1).fadeIn(2500);
			});

		}else if(r == 2){
			
			$('#column_'+ 2).hide();
			$('#column_'+ 3).hide();
			$('#column_'+ 4).hide();
			$('#column_'+ 5).hide();
			$('#column_'+ 1).fadeOut(2500,function(){
				$('#column_'+ 2).fadeIn(2500);
			});

		}else if(r == 3){
			
			$('#column_'+ 1).hide();
			$('#column_'+ 3).hide();
			$('#column_'+ 4).hide();
			$('#column_'+ 5).hide();
			$('#column_'+ 2).fadeOut(2500,function(){
				$('#column_'+ 3).fadeIn(2500);
			});

		}else if(r == 4){
			
			$('#column_'+ 1).hide();
			$('#column_'+ 2).hide();
			$('#column_'+ 4).hide();
			$('#column_'+ 5).hide();
			$('#column_'+ 3).fadeOut(2500,function(){
				$('#column_'+ 4).fadeIn(2500);
			});

		}else if(r == 5){
			
			$('#column_'+ 1).hide();
			$('#column_'+ 2).hide();
			$('#column_'+ 3).hide();
			$('#column_'+ 5).hide();
			$('#column_'+ 4).fadeOut(2500,function(){
				$('#column_'+ 5).fadeIn(2500);
			});
		}
		
		r++;
		if(r > 5){ r=1;}

   }//if 

   setTimeout('rolling_column()', 6500);
}

function changeimage(x,total){

	for(j=1;j<=total;j++){
		
		if(j==x){ 
			$('#test_'+ j).show();
			$('#m_c_image_'+ j).attr('src','./img/circle_green'+j+'.gif'); 
		}else{
			$('#test_'+ j).hide();
			$('#m_c_image_'+ j).attr('src','./img/circle_gray'+j+'.gif'); 
		}
		
		i=x+1;

	}//for	

}

function changestar(x){

	for(j=1;j<4;j++){
		
		if(j==x){
			$('#star_'+ j).show();
		}else{
			$('#star_'+ j).hide();
		}

		k=x+1;

	}//for	

}

function changecolumn(x){

	for(j=1;j<6;j++){
		
		if(j==x){
			$('#column_'+ j).show();
		}else{
			$('#column_'+ j).hide();
		}

		r=x+1;

	}//for	

}

function changestudy(x){

	for(j=1;j<3;j++){
		
		if(j==x){
			$('#study_'+ j).show();
		}else{
			$('#study_'+ j).hide();
		}

		i=x+1;

	}//for	

}
function changepost(x){

	for(j=1;j<3;j++){
		
		if(j==x){
			$('#post_'+ j).show();
		}else{
			$('#post_'+ j).hide();
		}

		i=x+1;

	}//for	

}

$(function(){


});
