/*
* by @mosf (http://www.mosf.go.kr)
*/

$.fn.thumbGrid = function(){
	var $boardType = this; 
	
	$boardType.find('> div').each(function(i, e){		
		$(this).addClass('wide25');
		if(i == 0){
			$(this).removeClass('wide25').addClass('wide50');
		} else if(i == 5){
			$(this).removeClass('wide25').addClass('wide50');
		} else if(i == 6){
			$(this).removeClass('wide25').addClass('wide50');
		}
	});
};


//$.fn.photoGrid = function(){
//	var $boardType = this; 
//	
//	$boardType.find('> div').each(function(i, e){		
//		$(this).addClass('width25');
//		if(i == 0){
//			$(this).removeClass('width25').addClass('width50');
//		} else if(i == 5){
//			$(this).removeClass('width25').addClass('width50');
//		} else if(i == 6){
//			$(this).removeClass('width25').addClass('width50');
//		}
//	});
//};

//$.fn.grdClass = function(){
//	var grdColor = ['grdColor1', 'grdColor2', 'grdColor3'];
//	$(this).removeClass();
//	$(this).addClass(function(){
//		return grdColor[Math.floor(Math.random() * grdColor.lenth)];
//	});
//};

$.fn.imageGrid = function(){	
	var $screenW = $('body').width(),
		$grid = this,
		$gridW = this.width() / 3;
	
	if($screenW > 768){
		// 그리드 - 포토뉴스, 동영상자료 썸네일 이미지 그리트 패턴
		this.find('.grid-item').css('width', $gridW);
		$grid.imagesLoaded(function(){
			$grid.masonry({
				itemSelector : '.grid-item',
				columnWidth : (Math.floor($gridW)),
				isAnimated : true
			});
		});
	}
};

$.fn.fileDown = function(){
	var $file = this;
	$file.on('click', function(){
		$.ajax({
			url : '/com/cmm/fms/updateFileDownLoadCnt.do',
			dataType : "json",
			data : { "atchFileId" : $('#paramAtchFileId').val()},
			success : function(data) {
				
			}
		});
		
		$('.fileInfo').slideToggle();
		$file.find('i').toggleClass('rotate');
		if($file.find('i').hasClass('rotate')){
//			alert('첨부파일창 닫기');
			$file.find('i').text('첨부파일창 닫기');
		} else {
//			alert('첨부파일창 열기');
			$file.find('i').text('첨부파일창 열기');			
		}
	});
};

/*$(function(){	
	// 이미지맵 반응형 처리
	$('img[usemap]').rwdImageMaps();
});*/
