//하단의 체크박스 전체 선택/선택 취소
//tableId: 삭제할 checkbox tag가 포함된 테이블의 ID
//className: 선택적으로 삭제할 checkbox에 지정한 class 이름
//value: 사용자가 직접 체크하는 체크박스의 값
function msgboxDetail(id,type,service_type) {
/*
	$('msgbox_search_body').style.display = 'none';
	
	$('msg_loading_'+id).style.display = '';

	new Ajax.Request( 'msgbox/detail.php?ei_idx=' +id , { 
		asynchronous:true, 
		evalScripts:true, 
		onComplete:function(t) {
			try {
				if(t.responseText.substr(0,7)=='[ERROR]') {
					$('msgbox_search_body').style.display = '';
					alert(t.responseText.replace('[ERROR]',''));
				}
				else {
					$('layerDetail_contentBody').innerHTML =  t.responseText;
					$('layerDetail').style.display='';
				}
			}
			catch(e) {
				alert(e);
			}

			$('msg_loading_'+id).style.display = 'none';
		
		}
	} );	
*/
	location.href='msgbox/mn_detail.php?ei_idx='+id+'&type='+type+'&ei_service_type='+service_type;
}

function linkMsgboxDetail(idx, type,service_type, useType) {
	if(useType==2){
		url = './msgbox/mn_detail.php';
	}else{
		url = './msgbox/msgboxDetail.php';
	}
	formName = 'EmTranInfoIndex/'+type+'Form';
	$(formName).action=url + "?ei_idx="+idx+'&type='+type+'&ei_service_type='+service_type;
	$(formName).submit();
}

function msgboxDetail_excel(id,type,service_type) {
	location.href='msgbox/mn_detail.php?ei_idx='+id+'&type='+type+'&ei_service_type='+service_type;
}

function changePaging() {
	$('recipients_list').innerHTML = '';
	if(parent.$('msgbox_detail_list_loading') != null) {
		parent.$('msgbox_detail_list_loading').style.display='';
	}
}

function chkSelectedCheckbox(pid, chkclass) {
	var items = $(pid).getElementsByClassName(chkclass);

	if(items == null) return;
	if(items.length == null) return;

	for(var i=0 ; i < items.length ; i++) {
			if(items[i].checked) {
				return  true;
			}
	}

	alert('항목이 선택되지 않았습니다');
	return false;

}

function searchMobile(){
	if($('SearchNumber').value.length<4 && $('SearchNumber').value.length>0){
		alert("검색어는 4글자 이상 입력해 주시기 바랍니다.");
		$('SearchNumber').focus();
		return false;
	}
	if($('pageLocation').value==2){
		$('MsgDetailSearchForm').action = "./mn_detail.php";
	}else{
		$('MsgDetailSearchForm').action = "./msgboxDetail.php";
	}
	$('tpage').value='';
	$('MsgDetailSearchForm').method='post';
	$('MsgDetailSearchForm').target='_self';
	return true;
}

function pageMoveLink(page) {
	$('tpage').value=page;
	$('MsgDetailSearchForm').method='post';
	if($('pageLocation').value==2){
		$('MsgDetailSearchForm').action = "./mn_detail.php";
	}else{
		$('MsgDetailSearchForm').action = "./msgboxDetail.php";
	}
	$('MsgDetailSearchForm').submit();
}

function selectResultList(resultStr){
	$('tpage').value='';
	$('SearchNumber').value='';
	$('resultPart').value=resultStr;	
	$('MsgDetailSearchForm').method='post';
//	resultTypePrint
	if($('pageLocation').value==2){
		$('MsgDetailSearchForm').action = "./mn_detail.php";
	}else{
		$('MsgDetailSearchForm').action = "./msgboxDetail.php";
	}
	$('MsgDetailSearchForm').submit();
}

function moveMsgList(type){
	if(type==2){
		$('MsgDetailSearchForm').action = "/bzexcel/send_list.html";
	}else{
		$('MsgDetailSearchForm').action = "/views/mn_msgbox.php";
	}
	$('MsgDetailSearchForm').method='get';
	$('MsgDetailSearchForm').submit();
}

function downExcelMsgboxDetail(type) {
	if(type==2){
		url = './mn_detailExcel.php';
	}else{
		url = './msgboxDetailExcel.php';
	}

	$('MsgDetailSearchForm').action=url;
	$('MsgDetailSearchForm').method='post';
	$('MsgDetailSearchForm').target="excelproc";
	$('MsgDetailSearchForm').submit();
}
function divSmsLoading(DivMtPr,num)
{	
	$('div_text_num').value = num;
	
	$('MsgDetailSearchForm').method='post';
	$('MsgDetailSearchForm').action = "./msgboxDetail.php";
	$('MsgDetailSearchForm').submit();
}
