// 원본이미지 보기 ##################################################
function openOrgImageView(path) {
	if (path.stripspace() == "") return;
	openPopup("/common/pop_orgImageView.asp?path="+encodeURI(path), "OrgImageView", 100, 100, "status=yes, resizable=yes");
}

// 상품이미지 보기 ##################################################
function openZoomGoodsImg(guid, cate) {

	//openPopup("/common/pop_zoom_goods.asp?guid="+guid+"&cate="+cate, "ZoomGoodsImg", 786, 470);
	openPopupCenter("/common/pop_zoom_goods.asp?guid="+guid+"&cate="+cate, "ZoomGoodsImg", 786, 470);
}

// 새창보기 상품상세 보기 ##################################################
function openNewGoodsImg(guid, cate, partGbn) {
      openPopup("/goods/pop_info_goods.asp?guid="+guid+"&cate="+cate+"&partGbn="+partGbn, "ZoomGoodsImg"+guid, 742, 650, " scrollbars=yes");	
}


// 주민등록번호 유효성 체크 ##################################################
function checkResNo(resNo1, resNo2) {
	var i;

	if (resNo1.value.stripspace() == "" || resNo2.value.stripspace() == "") return false;

	var total = 0;
	var key = new Array(2,3,4,5,6,7,8,9,2,3,4,5);
	var resNo = resNo1.value + resNo2.value;

	if (resNo.length == 13) {
		for (i=0; i<12; i++) {
			total = total + (eval(resNo.charAt(i)) * key[i]);
		}
		result = (11 - (total % 11)) % 10;

		if (eval(resNo.charAt(12)) != result) {
			alert ("유효한 주민등록번호가 아닙니다.");
			resNo1.value = "";
			resNo2.value = "";
			resNo1.focus();
			return false;
		}
		else {
			return true;
		}
	}
	else if (resNo1.value.stripspace().length != 6) {
		alert("주민등록번호 앞자리는 6자리입니다. 다시 입력하세요.");
		resNo1.value = "";
		resNo1.focus();
		return false;
	}
	else if (resNo2.value.stripspace().length != 7) {
		alert("주민등록번호 뒷자리는 7자리입니다. 다시 입력하세요.");
		resNo2.value = "";
		resNo2.focus();
		return false;
	}
}

// 사업자번호 유효성 체크 ##################################################
function checkBizNo(bizno1, bizno2, bizno3) {
	var i, ChkRule = "137137135";
	var step1, step2, step3, step4, step5, step6, step7;

	var strBizNo = bizno1.value + bizno2.value + bizno3.value; // 사업자번호 10자리

	step1 = 0; // 초기화

	for (i=0; i<7; i++) {
		step1 = step1 + (strBizNo.substring(i, i+1) *ChkRule.substring(i, i+1));
	}

	step2 = step1 % 10;
	step3 = (strBizNo.substring(7, 8) * ChkRule.substring(7, 8))% 10;
	step4 = strBizNo.substring(8, 9) * ChkRule.substring(8, 9);
	step5 = Math.round(step4 / 10 - 0.5);
	step6 = step4 - (step5 * 10);
	step7 = (10 - ((step2 + step3 + step5 + step6) % 10)) % 10;

	if (strBizNo.substring(9, 10) != step7) {
		alert ("유효한 사업자번호가 아닙니다.");
		bizno1.value = "";
		bizno2.value = "";
		bizno3.value = "";
		bizno1.focus();
		return false;
	}
	else {
		return true;
	}
}

// 로그인 ##################################################
function gotoLogin() {
	location.href =  "/"; //"/login.asp?redirect="+escape(document.URL);
}

function payment_Detail(uid){
    var f = document.Frm;
	openPopupCenter('/admin/order/pay_input.asp?orderUid='+uid, 'payment_detail', '1185', '500', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
}


//로그인 최상위 페이지로

function gotoLoginTop() {
	top.location.href = "/login.asp?redirect="+escape(parent.document.URL);
}

 ////선택된 부분의 SMS 여러개를 체크한다. 
function smsPopupPhone(){

		var f = document.Frm;
		var items_mobile     = "";
        var items_mobilename = "";
		var check_no ="";
		
     
	   
		if (!f.cbList) return;

		if (typeof(f.cbList.length) == "undefined") {
			if (f.cbList.checked) {	
			    if (f.cbList.checked) check_no = document.getElementById("idxI["+f.cbList.value+"]").value;
				items_mobile         = document.getElementById("ordHp["+check_no+"]").value;		
		        items_mobilename     = document.getElementById("ordName["+check_no+"]").value;
			}
		}
		else {
			for (i=0, len=f.cbList.length; i<len; i++) {
				 if (f.cbList[i].checked){
				    check_no = document.getElementById("idxI["+f.cbList[i].value+"]").value;
					if (document.getElementById("ordHp["+check_no+"]").value !=""){
					  items_mobile += ((items_mobile) ? "," : "")+document.getElementById("ordHp["+check_no+"]").value;
					  items_mobilename += ((items_mobilename) ? "," : "")+ document.getElementById("ordName["+check_no+"]").value;
					}
				}
			}		
		}
				
		if (items_mobile == "") {
			alert("SMS보낼 항목을 선택해 주세요.");
			return ;
		}	
     
		f.sms_mobile.value     = items_mobile;		
		f.sms_mobilename.value = items_mobilename;		

	  var newWin = window.open('', 'resultWin','width=500,height=400,menubar=no,resizable=no,scrollbars=no');

		f.target ="resultWin";
		f.action ="/admin/sms/sms_phone.asp";		
		f.submit();
		newWin.focus();
		
}


 

/////상세보기 팝업처리 하는 부분
function ShowGoodsDetail(guid, cate) {
	openPopupCenter("/goods/pop_goodscont.asp?guid="+guid+"&cate="+cate, "goodsDeatil", "790", "700", "scrollbars=yes");
}

