
// ȣ  üũÿ ȣ Ȱȭ Ǵ Լ
function fzipcodeCheck(val) {
    var inputField = document.frm.fzipcode;
    if(val.checked == true) {
        inputField.disabled = true;
    } else {
        inputField.disabled = false;
    }
    return;
}

function search_zip( zip1, zip2, addr1, frm, type ) {
    var page='address';

    url = '/front/php/zipcode_search/zipcode_search.php?page='+page+'&type='+type+'&zip1='+zip1+'&zip2='+zip2+'&addrs='+addr1+'&form='+frm ;
    winname = 'zipcode';
    option = 'toolbar=no location=no scrollbars=yes resizable=no width=466 height=450' ;
    opener = window.open( url, winname, option ) ;
}

/************************************************************************************

ֹ ϸ  ̵ ֹ/  ϸ  Ʈ ϰ,
ٽ ֹ  ƿ .. â ٿ.

************************************************************************************/

function load_order_select() {
    //alert('ýַ 񽺰  ߴܵǰ ֽϴ.');
    //return false;
    var f = document.frm;
    if (f.pay_status.value == 'order') {
        var wleft = (screen.width - 500) / 2;
        var wtop = (screen.height  - 450) / 2;

        //oname  /  / 2009-06-09 
        //ul = '/front/php/payment/payment.php?basket_type='+f.basket_type.value+'&a_input_mile='+f.a_input_mile.value+'&oname='+f.oname.value;
        ul = '/front/php/payment/payment_local.php?basket_type='+f.basket_type.value+'&a_input_mile='+f.a_input_mile.value;
        option = 'status:false; dialogWidth: 500px; dialogHeight: 450px; help:no; dialogLeft:'+ wleft +'; dialogTop:'+ wtop +'; status:no; scroll:no;'

        var oWin = showModalDialog( ul, window, option );
        //Window.open(ul,'_blank');
    }
}

function tcash_winopen() {
    var wleft = (screen.width - 500) / 2;
    var wtop = (screen.height  - 450) / 2;
    window.open('about:blank', 'tcashwin', 'left='+wleft+', top='+wtop+', width=389, height=537, scrollbar=no, resizable=no');
}

function set_total_price() {
    var bError = false;
	// 2009-06-30 : ۺ  η   α -  ؿ
	if (document.getElementsByName("use_ship_fee")[0].value == "F" && typeof(frm.input_mile) != 'undefined') {
		if (document.getElementsByName("input_mile")[0].value > document.getElementsByName("product_total_price")[0].value) {
			alert("   ۺ   ϽǼ ϴ.\nǰ ݸ  մϴ.");
			document.getElementsByName("input_mile")[0].value = document.getElementsByName("input_mile")[0].value - document.getElementsByName("ship_fee")[0].value;
			return false;
		}
	}

	// 2009-06-30 :      Ȯ  -  ؿ
	if (document.getElementsByName("set_mileage_exception")[0].value == "F") {
		alert("   ش ǰ  ޵ ʽϴ.");
		return false;
	}

    var f = document.frm;
    f.total_price.value = f.r_total_price.value;
    if (typeof(f.input_mile)!='undefined') {
        f.total_price.value = f.total_price.value - f.input_mile.value;
    }

    // ߷ ߰(r_total_price  ΰ ԵǾ ־ и). 2010-12-07 .
    if (typeof(f.coupon_shipfee) != 'undefined') {
        f.total_price.value = f.total_price.value - f.coupon_discount.value - f.coupon_shipfee.value;
    }

    //̹Ʈ 
    var bError = false;
    if (typeof(f.np_use) != 'undefined') {
        var iNpUseAmt = parseInt(document.getElementById('npUseAmt').value, 10);
        if (iNpUseAmt > 0) {
            var iTotalTmp = parseInt(f.total_price.value, 10) - parseInt(iNpUseAmt, 10);
            if (iTotalTmp < 0) {
                alert('ϼž  ݾ׺ ݾ Ůϴ. ٽ ݾ Էּ.');
                bError = true;
            } else {
                f.total_price.value = iTotalTmp;
            }
        }
    }
    if (bError == true) return false;
}

// Form   Էߴ ˻.
function check_info_frm() {
    
    var check = 'true';

    /* ֹ ˻. */
    if( frm.oname.value == '' ) {
        alert( 'ֹ  Է ֽʽÿ.') ;
        frm.oname.focus() ;
        check = 'false';
        return false;
    }
    if( frm.ozipcode1.value == '' ) {
        alert('ֹ ȣ Է ֽʽÿ.') ;
        frm.ozipcode1.focus() ;
        check = 'false';
        return false;
    }
    if( frm.ozipcode2.value == '' ) {
        alert('ֹ ȣ Է ֽʽÿ.') ;
        frm.ozipcode2.focus() ;
        check = 'false';
        return false;
    }
    if( frm.oaddr1.value == '' ) {
        alert('ֹ  ּҸ Է ֽʽÿ.') ;
        frm.oaddr1.focus() ;
        check = 'false';
        return false;
    }
    if( frm.oaddr2.value == '' ) {
        alert('ֹ  ּҸ Է ֽʽÿ.') ;
        frm.oaddr2.focus() ;
        check = 'false';
        return false;
    }else{
        //ּҳ Ȯϼ ġȯ
        frm.oaddr2.value = replaceKRCP949(frm.oaddr2.value);
    }
    if( frm.ophone1_1.value == '' ) {
        alert('ֹ  ȭ ȣ Է ֽʽÿ.') ;
        frm.ophone1_1.focus() ;
        check = 'false';
        return false;
    }
    if( frm.ophone1_2.value == '' ) {
        alert('ֹ  ȭ ȣ Է ֽʽÿ.') ;
        frm.ophone1_2.focus() ;
        check = 'false';
        return false;
    }
    if( frm.ophone1_3.value == '' ) {
        alert('ֹ  ȭ ȣ Է ֽʽÿ.') ;
        frm.ophone1_3.focus() ;
        check = 'false';
        return false;
    }
    if( frm.oemail.value == '' ) {
        alert('ֹ E-mail ּҸ Է ֽʽÿ.') ;
        frm.oemail.focus() ;
        check = 'false';
        return false;
    }

    // ϶
    if(typeof(frm.delvType) == 'undefined' || frm.delvType.value == 'A' || frm.delvType.value == ' ') {
        /*  ˻. */
        if( frm.rname.value == '' ) {
            alert( '  Է ֽʽÿ.') ;
            frm.rname.focus() ;
            check = 'false';
            return false;
        }
        if( frm.rzipcode1.value == '' ) {
            alert(' ȣ Է ֽʽÿ.') ;
            frm.rzipcode1.focus() ;
            check = 'false';
            return false;
        }
        if( frm.rzipcode2.value == '' ) {
            alert(' ȣ Է ֽʽÿ.') ;
            frm.rzipcode2.focus() ;
            check = 'false';
            return false;
        }
        if( frm.raddr1.value == '' ) {
            alert('  ּҸ Է ֽʽÿ.') ;
            frm.raddr1.focus() ;
            check = 'false';
            return false;
        }
        if( frm.raddr2.value == '' ) {
            alert('  ּҸ Է ֽʽÿ.') ;
            frm.raddr2.focus() ;
            check = 'false';
            return false;
        }else{
            //ּҳ Ȯϼ ġȯ
            frm.raddr2.value = replaceKRCP949(frm.raddr2.value);
        }
        if( frm.rphone1_1.value == '' ) {
            alert('  ȭ ȣ Է ֽʽÿ.') ;
            frm.rphone1_1.focus() ;
            check = 'false';
            return false;
        }
        if( frm.rphone1_2.value == '' ) {
            alert('  ȭ ȣ Է ֽʽÿ.') ;
            frm.rphone1_2.focus() ;
            check = 'false';
            return false;
        }
        if( frm.rphone1_3.value == '' ) {
            alert('  ȭ ȣ Է ֽʽÿ.') ;
            frm.rphone1_3.focus() ;
            check = 'false';
            return false;
        }
    }

    // ؿܹ϶
    else if(frm.delvType.value == 'B') {
        //var pattern = /[!@#$%^&*()_+=\-,.\/<>?[\]{};':"]/;
        var pattern = /[;]/;
        var pattern2 = /[0-9_-]/;
        //var name_patt = /[\u3130-\u318f\uac00-\ud7af]/;
        var name_patt = /^[a-zA-Z0-9 -]+$/;
        var addr_patt = /^[a-zA-Z0-9 \~\!\@\#\$\%\^\&\*\(\)\_\+\-\=\:\[\]\{\}\\\|\<\>\?\,\.\/]+$/;

        /*  ˻. */
        if( frm.fname.value.replace(/\s/g,'') == '') {
            alert('  Է ֽʽÿ.') ;
            frm.fname.focus() ;
            return false;
        }
        if(!name_patt.test(frm.fname.value)) {
            alert('  /ڷθ Է°մϴ.');
            frm.fname.focus();
            return false;
        }
        if(frm.fCountryCd.value == '') {
            alert(' ڵ带  ֽʽÿ.');
            frm.fCountryCd.focus();
            return false;
        }

        if(frm.bFzipcode.checked == false) {
            if(frm.fzipcode.value.replace(/\s/g,'') == '') {
                alert('ش籹 ȣ Է ֽʽÿ.\n\nȣ   üũڽ ּ.');
                frm.fzipcode.focus();
                return false;
            }
            if(frm.fzipcode.value.length > 7) {
                alert(' ȣ ̴ 7 ̳ Էּ');
                frm.fzipcode.focus();
                return false;
            }
            if(!pattern2.test(frm.fzipcode.value)) {
                alert('ȣ ڸ ԷϽ  ֽϴ.');
                frm.fzipcode.focus();
                return false;
            }
        }

        if(frm.faddress.value.replace(/\s/g,'') == '') {
            alert(' ּҸ Է ֽʽÿ.');
            frm.faddress.focus();
            return false;
        }
        if(pattern.test(frm.faddress.value)) {
            alert('Ư ڴ ԷϽ  ϴ.');
            frm.faddress.focus();
            return false;
        }
        if(!addr_patt.test(frm.faddress.value)) {
            alert(' ּҴ /ڿ Ư  Ϻ ~ ! @ # $ % ^ & * ( ) _ + - = : [ ] { } \\ | < > ? , . / θ Է°մϴ.');
            frm.faddress.focus();
            return false;
        }
        if(!check_byte(frm.faddress, 200, 'ּҴ / 200̳θ Է°մϴ.')){
            frm.faddress.focus();
            return 'false';
        }
        if(frm.fphone1_1.value == '' || frm.fphone1_2.value == '' || frm.fphone1_3.value == '' || frm.fphone1_4.value == '') {
            alert('  ȭȣ Է ֽʽÿ.');
            frm.fphone1_1.focus();
            return false;
        }
        if((frm.fphone1_1.value+frm.fphone1_2.value+frm.fphone1_3.value+frm.fphone1_4.value+'').length > 20) {
            alert('  ȭ ̴ 20 ̳ Էּ');
            frm.fphone1_1.focus();
            return false;
        }
        if(frm.fphone1_1.value.length < 2 || frm.fphone1_1.value.length > 3) {
            alert('  ȭ ù° ڸ 2~3ڸ ̳ Էּ.');
            frm.fphone1_1.focus();
            return false;
        }
        if(frm.fphone1_2.value.length < 2 || frm.fphone1_2.value.length > 3) {
            alert('  ȭ ι° ڸ 2~3ڸ ̳ Էּ.');
            frm.fphone1_2.focus();
            return false;
        }
        if(frm.fphone1_3.value.length < 2 || frm.fphone1_3.value.length > 4) {
            alert('  ȭ ° ڸ 2~4ڸ ̳ Էּ.');
            frm.fphone1_3.focus();
            return false;
        }
        if(frm.fphone1_4.value.length < 2 || frm.fphone1_4.value.length > 4) {
            alert('  ȭ ׹° ڸ 2~4ڸ ̳ Էּ.');
            frm.fphone1_4.focus();
            return false;
        }
        if(!pattern2.test(frm.fphone1_1.value+frm.fphone1_2.value+frm.fphone1_3.value+frm.fphone1_4.value+'')) {
            alert('ڸ ԷϽ  ֽϴ.');
            frm.fphone1_1.focus();
            return false;
        }

        if(frm.fphone2.value) {
            if(frm.fphone2.value.length > 20) {
                alert(' ޴ ȭ ̴ 20 ̳ Էּ');
                frm.fphone1.focus();
                return false;
            }
            if(!pattern2.test(frm.fphone2.value)) {
                alert(' ޴ ȭ ڸ ԷϽ  ֽϴ.');
                frm.fphone2.focus();
                return false;
            }
        }
    }

    else {
        if(!check_byte(frm.oname, 20, 'ֹڸ ѱ 10̳θ Է°մϴ.')){
            frm.oname.focus();
            return 'false';
        }
        if(!check_byte(frm.oaddr1, 255, 'ּҴ ѱ 125̳θ Է°մϴ.')){
            frm.oaddr1.focus();
            return 'false';
        }
        if(!check_byte(frm.oaddr2, 255, 'ּҴ ѱ 125̳θ Է°մϴ.')){
            frm.oaddr2.focus();
            return 'false';
        }
        if(!check_byte(frm.oemail, 40, '̸ֹ 40̳θ Է°մϴ.')){
            frm.oemail.focus();
            return 'false';
        }
        if(!check_byte(frm.rname, 20, 'ڸ ѱ 10̳θ Է°մϴ.')){
            frm.rname.focus();
            return 'false';
        }
        if(!check_byte(frm.raddr1, 255, 'ּҴ ѱ 125̳θ Է°մϴ.')){
            frm.raddr1.focus();
            return 'false';
        }
        if(!check_byte(frm.raddr2, 255, 'ּҴ ѱ 125̳θ Է°մϴ.')){
            frm.raddr2.focus();
            return 'false';
        }

        var telno  = frm.rphone1_1.value + '-' + frm.rphone1_2.value + '-' + frm.rphone1_3.value;
        if(str_size_check(telno) > 20){
            alert(' ȭȣ ȿ ʽϴ!');
            frm.rphone1_1.focus();
            return 'false';
        }

        var telno  = frm.rphone2_1.options[frm.rphone2_1.selectedIndex].value + '-' + frm.rphone2_2.value + '-' + frm.rphone2_3.value;
        if(str_size_check(telno) > 20){
            alert(' ޴ȭȣ ȿ ʽϴ!');
            frm.rphone2_2.focus();
            return 'false';
        }
        if(!check_byte(frm.omessage, 255, '۸޽ ѱ 125̳θ Է°մϴ.')){
            frm.omessage.focus();
            return 'false';
        }
    }

    if(frm.order_password != undefined){
        //ȸ йȣ ȿüũ jsyoon
        var opw_regex = /^[a-z\d]{4,12}$/i;
        if(!opw_regex.test(frm.order_password.value)){
            alert('ȸйȣ  Ǵ  4~12ڸ մϴ.');
            frm.order_password.focus();
            return 'false'; 
        }
        if(document.getElementsByName("nm_agreement")[0].checked == false){
            alert('ȸ κȣå ϼž մϴ.');
            document.getElementsByName("nm_agreement")[0].focus();
            return 'false';
        }
    }
    
    
    //ֹ ߰׸ ʼ üũ
    try {
        for(var i=0; i<frm.elements.length; i++){
            pre_input = frm.elements[i];
            if (pre_input.require == 'T') {
                if (pre_input.type == 'checkbox' || pre_input.type == 'radio') {
                    if (pre_input.checked == false) {
                        var sCheckFlag = false;
                        for (j=0; j < frm.elements[pre_input.name].length; j++) {
                            if (frm.elements[pre_input.name][j].checked === true) {
                                sCheckFlag = true;
                            }
                        }
                        if (sCheckFlag === false) {
                            alert('߰׸ Է ּ.');
                            pre_input.focus();
                            return false;
                        }
                    }
                } else {
                    if (pre_input.value == '') {
                        alert('߰׸ Է ּ.');
                        pre_input.focus();
                        return false;
                    }
                }
            }
        }
    } catch(e) {
    }
    try {
    if (document.getElementsByName('subscription_agree')[0].checked == false){
        alert('ûöȸħ  ϼž ֹ մϴ.');
        document.getElementsByName('subscription_agree')[0].focus();
        return false;
    }
    } catch(e) {
    }

    try
    {
        if( typeof(frm.daum_agreement_check) != 'undefined' && document.getElementsByName('daum_agreement_check')[0].checked == false){
			alert('  ּ.');
			document.getElementById('daum_agreement_check').focus();
			return false;
        }
    } catch (e) {
    }

    
    return check;
} // end of check_info_frm()

function open_pay()
{
    // alert(' Դϴ.\n ٽýõ ּ!');
    //return;
	//2008-10-28 迵 - ֹ,   

	// 2009-07-20 : ۸޽  -  ؿ
	try {
		document.getElementsByName("q_message")[0].value = (document.getElementById("oMsgChecked").checked == true) ? "T" : "F";
	} catch (e) {}

	var oFrm = document.forms['frm'];
	var delvType = oFrm['delvType'];
	
	var rname = '';
	var oname = oFrm['oname'];
	var oMsg  = '';

	//ؿܹ ÷ ִ Ȯ
	if(typeof(delvType) != 'undefined')
	{
		if(delvType.value == 'B') {
			rname = oFrm['fname'];
			oMsg  = oFrm['fmessage'];
		}
		else {
			rname = oFrm['rname'];
			oMsg  = oFrm['omessage'];
		}
	}
	else {
		rname = oFrm['rname'];
		oMsg  = oFrm['omessage'];
	}

	var oCnt = str_size_check(oname.value);
	var rCnt = str_size_check(rname.value);
	var omCnt = str_size_check(oMsg.value);

	if(oCnt>20){
		alert("ֹ  ڼ ѱ 10(20) ̳ ۼ ٶϴ.");
		oname.focus();
		return;
	}

	if(rCnt>20) {
		alert("  ڼ ѱ 10(20) ̳ ۼ ٶϴ.");
		rname.focus();
		return;
	}

	if(omCnt>255) {
		alert("۸޽ ڼ ѱ 125(255) ̳ ۼ ٶϴ.");
		oMsg.focus();
		return;
	}

    var check = check_info_frm();
    var usafe_check;

    if(document.frm.eguarantee_check.value == 'T') {
        usafe_check = eguarantee_ssn_check();

        if(!usafe_check) {
            return;
        }
    }
    
	selectbuy_action('','','',document.frm); 
	
    // ϶ ڰ  ¥  üũ(2006-09-08, Ƽ)
    if(document.frm.is_hope_shipping != undefined) {
        if(document.frm.is_hope_shipping.value == 'T') {

            //Ѻۿ
            if(document.frm.hope_shipping_fast.checked == true) {
                document.frm.is_fast_shipping.value = 'T';

            } else {
                document.frm.is_fast_shipping.value = 'F';
            }

            hdate_check = check_hope_date();
            if(!hdate_check) {
                return;
            }

        } else {
            document.frm.is_fast_shipping.value = 'F';
        }
    }

    try {

        if(shipfee_add > 0) {

            var msg = 'ش ';
            if(shipfee_add1 > 0 && shipfee_add2 > 0) {
                msg += '⺻ۺ Ư  ۺ : ' + number_format(shipfee_add1) + '\n';
                msg += 'ۺ Ư  ۺ : ' + number_format(shipfee_add2) + '\n'
                msg += 'Ư  ۺ հ ' + number_format(shipfee_add) + ' ߰˴ϴ.';
            } else {
                msg += 'Ư  ۺ ' + number_format(shipfee_add) + ' ߰˴ϴ.'
            }
            alert(msg);
        }

        if(parseInt(document.mincheck.product_total_price.value) < parseInt(document.mincheck.min_oprice.value)){
            alert('ǰűݾ ּ ֹɾ(' +
            number_format(document.mincheck.min_oprice.value) + ')  ۽ϴ');
            return;
        }
    } catch (e) {}

    if(check == 'true') {
        var discounted_amt = 0;
        var multi_coupon_discount = 0;
        var naver_point_discount = 0;

        try {
            if(document.frm.mil_group_dc != undefined && document.frm.mil_group_dc.value != '')
                discounted_amt += parseInt(document.frm.mil_group_dc.value);

            if(document.frm.coupon_mileage_discount != undefined && document.frm.coupon_mileage_discount.value != '')
                discounted_amt += parseInt(document.frm.coupon_mileage_discount.value);

        } catch(e){}

        try {
            if(!mileage_compare(discounted_amt))
                return;

                document.frm.total_price.value = document.frm.r_total_price.value;
                if (typeof(document.frm.input_mile)!='undefined') {
                    document.frm.total_price.value = document.frm.total_price.value - document.frm.input_mile.value;
                }
                // ž == ϸ  + ξ + ȸξ ϰ ǰ 0
                
                // ߰ ξ  . 2010-12-06 .
                if (typeof(frm.coupon_shipfee) != 'undefined') {// ΰ r_total_price ԵǾ ־  и
                    document.frm.total_price.value = document.frm.total_price.value - document.frm.coupon_discount.value - document.frm.coupon_shipfee.value;
                    multi_coupon_discount = parseInt(document.frm.coupon_discount.value, 10) + parseInt(document.frm.coupon_shipfee.value, 10);
                }

                //̹Ʈ 
                if (typeof(frm.np_use) != 'undefined') {
                    var iNpUseAmt = parseInt(document.getElementById('npUseAmt').value, 10);
                    if (iNpUseAmt > 0) {
                        document.frm.total_price.value = parseInt(document.frm.total_price.value, 10) - parseInt(iNpUseAmt, 10);
                        naver_point_discount = parseInt(iNpUseAmt, 10);
                    }
                }

            if(document.frm.input_mile.value > 0 && (parseInt(document.frm.total_price.value) - discounted_amt) == 0){
                document.frm.total_price.value -=  discounted_amt;
            }
        } catch (e) {}

        if(document.frm.total_price.value < 0) {
            document.frm.input_mile.value = 0;
            document.frm.total_price.value = document.frm.r_total_price.value;
            // ߷ ߰. 2011-02-15 .
            if (typeof(document.frm.coupon_shipfee) != 'undefined') { //r_total_price  ΰ ԵǾ ־ и.
                var iCouponPrice = parseInt(document.frm.coupon_discount.value, 10) + parseInt(document.frm.coupon_shipfee.value, 10);
                document.frm.total_price.value = parseInt(document.frm.total_price.value, 10) - parseInt(iCouponPrice, 10);
            }
            //̹Ʈ 
            if (typeof(document.frm.np_use) != 'undefined') {
                var iNpUseAmt = parseInt(document.getElementById('npUseAmt').value, 10);
                if (iNpUseAmt > 0) {
                    document.frm.total_price.value = parseInt(document.frm.total_price.value, 10) - parseInt(iNpUseAmt, 10);
                }
            }

            alert('ݾ ߸Ǿϴ.');
        } else {
            var total_amount  = parseInt(document.frm.r_total_price.value);

            try {
                var use_mile  = document.frm.input_mile.value;
            } catch (e) {
                var use_mile = 0;
            }
            if(!use_mile) {
                use_mile = 0;
            }
            use_mile  = parseInt(use_mile, 10);

            var iUsePoint = 0; //ܺƮ 
            iUsePoint = iUsePoint + naver_point_discount;//̹Ʈ

            var iDiscountAll = 0;
            iDiscountAll = parseInt(discounted_amt, 10) + parseInt(multi_coupon_discount, 10);
            if ((parseInt(iDiscountAll, 10) + parseInt(use_mile, 10) + parseInt(iUsePoint, 10)) < total_amount || total_amount == 0 || (total_amount > 0 && iDiscountAll == total_amount)) {
                document.frm.pay_status.value = 'order';
                load_order_select();

            } else if (total_amount == iUsePoint && total_amount > 0) {
                frm.action = '/front/php/order_point_a.php';

                frm.submit();
            } else {

                //2009-06-09. 
                frm.action = '/front/php/order_mileage_f.php' ;
                ssl_action      = document.frm.EC_SECURE_ACTION.value;
                ssl_data        = document.frm.ssl_data.value;
                ssl_return_page = document.frm.ssl_return_page.value;

                var node = document.createElement('div');
                node.style.display = 'none';
                node.innerHTML = '<input type="hidden" name="EC_SECURE_DATA" value="'+ssl_data+'" />';
                node.innerHTML += '<input type="hidden" name="EC_SSL_RETURN_PAGE" value="'+ssl_return_page+'" />';
                document.frm.appendChild(node);

                frm.action = ssl_action;
                frm.submit() ;
            }
        }
    } else {
        return;
    }
} // end of open_pay() ;

function mileage_compare(discounted_amt) {

    if (typeof(document.frm.input_mile)!='undefined') {
        if(!checkDigit(document.frm.input_mile.value)) {
            alert('ԷϽ ϸݾ ڰ ƴմϴ!');
            document.frm.input_mile.value = '';
            frm.input_mile.select();
            frm.input_mile.focus();
            return false;
        }

        var sErrMsg = "";
        var bUseMile = true;
        if(Math.ceil(document.frm.avail_mileage.value) < Math.ceil(document.frm.input_mile.value)) {
            sErrMsg = "밡 ݺ ϴ.";
            bUseMile = false;
        } else if(document.frm.total_price.value < 0) {
            sErrMsg = " ݾ ݾ׺ ϴ.";
            bUseMile = false;
        } else if(parseInt(document.frm.input_mile.value) > 0 && parseInt(document.frm.mileage_buyamt_limit.value) > 0) {
            if (parseInt(document.mincheck.product_total_price.value) < parseInt(document.frm.mileage_buyamt_limit.value)) {
                sErrMsg = 'ǰűݾ ' + number_format(document.frm.mileage_buyamt_limit.value) + ' ̻̾ \n Ͻ  ֽϴ.';
                bUseMile = false;
            }
        }
    }

    if (bUseMile == false) {
        // ߷ ߰. 2011-02-15 .
        var iCouponPrice = 0;
        if (typeof(document.frm.coupon_shipfee) != 'undefined') { //r_total_price  ΰ ԵǾ ־ и.
            iCouponPrice = parseInt(document.frm.coupon_discount.value, 10) + parseInt(document.frm.coupon_shipfee.value, 10);
        }
        //̹Ʈ ߰. 2011-06-01 .
        var iNpUseAmt = 0;
        if (typeof(document.frm.np_use) != 'undefined') {
            iNpUseAmt = parseInt(document.getElementById('npUseAmt').value, 10);
        }
        document.frm.input_mile.value = '';
        document.frm.total_price.value = parseInt(document.frm.r_total_price.value, 10) - parseInt(iCouponPrice, 10) - parseInt(iNpUseAmt, 10);
        alert(sErrMsg);
    }
    //ݾ - ι ݾ  0  ˻
    if((parseInt(document.frm.total_price.value) - discounted_amt) < 0){
        alert(' ݾ ε ݾ׺ ϴ.');
        bUseMile = false;
    }


    if (bUseMile == false) {
        return false;
    }
    return true;
} // end of mileage_compare()

function set_pdu_agree(pdu_agree) {
    document.frm.eguarantee_pdu_agree.value = pdu_agree;
}

function set_receiver( same_addr ) {
    if( same_addr == 'T' ) {
        frm.rname.value = frm.oname.value;
        frm.rzipcode1.value = frm.ozipcode1.value;
        frm.rzipcode2.value = frm.ozipcode2.value;
        frm.raddr1.value = frm.oaddr1.value;
        frm.raddr2.value = frm.oaddr2.value;
        frm.rphone1_1.value = frm.ophone1_1.value;
        frm.rphone1_2.value = frm.ophone1_2.value;
        frm.rphone1_3.value = frm.ophone1_3.value;
        frm.rphone2_1.value = frm.ophone2_1.value;
        frm.rphone2_2.value = frm.ophone2_2.value;
        frm.rphone2_3.value = frm.ophone2_3.value;
    } else {
        frm.rname.value = '';
        frm.rzipcode1.value = '';
        frm.rzipcode2.value = '';
        frm.raddr1.value = '';
        frm.raddr2.value = '';
        frm.rphone1_1.value = '';
        frm.rphone1_2.value = '';
        frm.rphone1_3.value = '';
        frm.rphone2_1.value = '';
        frm.rphone2_2.value = '';
        frm.rphone2_3.value = '';
    }
    selectbuy_action('','','',document.frm); 
    set_remote_shipfee();
} // end of set_receiver() ;

function set_remote_shipfee(shipfee_ifr)
{
    var frm = document.frm;
    var shipfee_ifr = document.getElementById('shipfee_calc');
    shipfee_ifr.src = '/front/php/set_shipfee.php?basket_type=' + frm.basket_type.value + '&zipcode=' +  frm.rzipcode1.value + '-' + frm.rzipcode2.value;
    
    try {
        shipfee_ifr.location.reload();
    } catch(e) {}
}

//   ٱ .
function add_basket( arg,product_no,cnt,min,pdt_type ) {

    var f= document.frm;
    var count = f.elements.length;
    var chkOK = 0;
    var i,j;
    var ename;
    var quantity;
    var return_check = 'true';
    var num_of_prod= f.num_of_prod.value;//߰

    for(i=0; i< count; i++){
        ename = f.elements[i].name;
        
        for(np=0; np< num_of_prod; np++){//߰
            
            //if ( ename == 'quantity'+cnt)
            if ( ename == 'quantity'+np) { //߰
                //f.quantity.value = cnt;
                // f.product_no.value = product_no;
                quantity = f.elements[i].value;

                 if (! quantity) {
                    alert (' Է ֽʽÿ.');
                    f.elements[i].focus();
                    f.elements[i].value = 1;
                    return_check = 'false';
                 }

                 if (quantity==0) { //߰
                    alert ('ǰ ְ 1̻ ֹ ̷մϴ.');
                    f.elements[i].focus();
                    f.elements[i].value = 1;
                    return_check = 'false';
                 }//߰

                 for (j = 0; j <  f.elements[i].value.length; j++) {
                     if (! (f.elements[i].value.charAt(j) >= '0' && f.elements[i].value.charAt(j) <= '9')) {
                         alert (' ڸ մϴ.');
                         f.elements[i].value.charAt(j)= 1;
                         f.elements[i].select();
                         return_check = 'false';
                     }
                 }
            }
        }
    }

    quantity = eval('document.frm.quantity'+cnt+'.value');//߰

    if (check_frm(quantity,min) && return_check == 'true') {
    if ( pdt_type ) frm.pdt_type.value = pdt_type;
        frm.action = '/front/php/basket.php?quantity='+quantity;
    } else {
        eval('document.frm.quantity'+cnt).value = min;
        frm.action = '/front/php/basket.php?quantity='+min;
    }
    frm.submit();
}

function check_frm(quantity,min) {
    if (parseInt(quantity) < min) {
        alert ('ּ ֹ ' + min + ' Դϴ.');
        return false;
    }

    return true;
}

if (typeof(lpinfo) != 'undefined') {
    document.cookie = 'lpinfo=' + lpinfo;
}

function eguarantee_ssn_check() {
    if(document.frm.is_eguarantee.value=='T') {
        if(document.frm.eguarantee_ssn1.value == '' || document.frm.eguarantee_ssn2.value == '') {
            alert('ں ߱޹÷, ֹιȣ Էϼž  մϴ.');
            return false;

        } else if( document.frm.eguarantee_pdu_agree.value == 'F') {
            alert('ں ߱޹÷,  ̿뵿ǰ ʿմϴ.');
            return false;

        } else {
            return true;
        }
    }
}

function is_eguarantee_input(is_eguarantee_status) {
    document.frm.eguarantee_check.value = is_eguarantee_status;
    document.frm.is_eguarantee.value = is_eguarantee_status;
}

// ߰
function open_coupon_popup(basket_type) {
    window.open(('/front/php/coupon/coupon_select.php?basket_type=' + basket_type),
    'giftloginwin','height=394,width=667,scrollbars=yes,resizable=yes');
}

//  (new) 2010-11-18. 
function open_coupon_new() {
    var f = document.frm;
    var cpn_basket_type = f.basket_type.value;
    if (cpn_basket_type!="") {
        var str = '/front/php/coupon/coupon_select_new.php?basket_type=' + cpn_basket_type;
        if (f.sCpnPrd.value!="") str = str + "&sCpnPrd=" + f.sCpnPrd.value;
        if (f.sCpnOrd.value!="") str = str + "&sCpnOrd=" + f.sCpnOrd.value;

        window.open(str, 'coupon_pop','height=650,width=880,scrollbars=yes,resizable=yes');

    } else {
        alert(' ùٸ ʽϴ.');
        return false;
    }
}

//  ¥ üũ(2006-09-08, Ƽ)
function check_hope_date() {

    var fix_date = frm.fix_date.value;
    var fix_dateY = fix_date.substr(0, 4);
    var fix_dateM = fix_date.substr(5, 2);
    var fix_dateD = fix_date.substr(8, 2);

    var select_hope_date =new Date(frm.hdateY.value, frm.hdateM.value, frm.hdateD.value);
    var fixed_hope_date = new Date(fix_dateY, fix_dateM, fix_dateD);

    if(select_hope_date.getTime() < fixed_hope_date.getTime()) {
        alert(' ' + fix_date + '   ¥ Էؾ մϴ');
        hdate = new dsInput( 'hdate', 'frm', frm.fix_date.value); // Default
        frm.hdateD.focus();
        return false;
    } else {
        frm.hope_date.value = frm.hdateY.value+'-'+frm.hdateM.value+'-'+frm.hdateD.value;//̼ 
        return true;
    }
}

//  üũ ¥ Ȱȭ(2006-09-08, Ƽ)
function check_fastship()
{
    var f = document.frm;

    if(f.hope_shipping_fast.checked == true) {

        //hdate = new dsInput( 'hdate', 'frm', f.fix_date.value); // Default
        f.hdateY.disabled = true;
        f.hdateM.disabled = true;
        f.hdateD.disabled = true;
        f.hdateW.disabled = true;
    } else {
        f.hdateY.disabled = false;
        f.hdateM.disabled = false;
        f.hdateD.disabled = false;
        f.hdateW.disabled = false;
    }
}

/**
* The date selector constructor
*
* @access public
* @param string objName      Name of the object that you create
* @param string formName	Name of the form this object is in (OPTIONAL)
*/
function dsInput(objName, formName, objDate) {

    /* Properties */
    /*
    this.objName = objName;
    this.today = new Date();
    this.date = this.today.getDate();
    this.month = this.today.getMonth()+1;
    this.year = this.today.getFullYear();
    this.week = this.today.getDay()+1;
    */

    this.objName= objName;
    this.objDate = objDate;

    if(this.objDate == '') {
        this.today          = new Date();
        this.date           = this.today.getDate();
        this.month          = this.today.getMonth()+1;
        this.year           = this.today.getFullYear();
        this.week = this.today.getDay()+1;
    } else {
        //this.today          = new Date(this.objDate.substr(0, 4), this.objDate.substr(5, 2)-1, this.objDate.substr(8, 2));
        var stringVar = this.objDate;
        splitString=stringVar.split('-');
        this.today = new Date(splitString[0], splitString[1]-1, splitString[2]);
        this.date           = this.today.getDate();
        this.month          = this.today.getMonth()+1;
        this.year           = this.today.getFullYear();
        this.week = this.today.getDay()+1;
    }

    if(this.year < 2000) this.year += 1900; //for Netscape
    this.yearComboRange = 5;
    this.formName = arguments[1] ? arguments[1] : 'none';
    this.dayObj = '';
    this.monthObj = '';
    this.yearObj = '';
    this.weekObj = '';
    this.monthNames = new Array( '','01','02','03','04','05','06','07','08','09','10','11','12' );
    this.weekNames = new Array('','','ȭ','','','','');

    /* Public Methods */
    this.setToToday = ds_setToToday;
    this.adjustDaysInMonth = ds_adjustDaysInMonth;
    this.setDate = ds_setDate;
    this.setDateParts = ds_setDateParts;
    this.getSelYear = ds_getYear;
    this.getSelMonth = ds_getMonth;
    this.getSelDay = ds_getDay;
    this.getSelWeek = ds_getWeek;

    /* Private Methods */
    this._initOptions = ds_initOptions;
    this._writeYearOptions = ds_writeYearOptions;
    this._writeMonthOptions = ds_writeMonthOptions;
    this._writeDayOptions = ds_writeDayOptions;
    this._writeWeekOptions = ds_writeWeekOptions;

    this._getDaysInMonth = ds_getDaysInMonth;
    this._getWeeksInDay = ds_getWeeksInDay;

    /* Constructor Code */
    if( this.formName == 'none' ) {
        this.dayObj = eval('document.forms[0].' + this.objName + 'D');
        this.monthObj = eval('document.forms[0].' + this.objName + 'M');
        this.yearObj = eval('document.forms[0].' + this.objName + 'Y');
        this.weekObj = eval('document.forms[0].' + this.objName + 'W');
    } else {
        this.dayObj = eval('document.' + this.formName + '.' + this.objName + 'D');
        this.monthObj = eval('document.' + this.formName + '.' + this.objName + 'M');
        this.yearObj = eval('document.' + this.formName + '.' + this.objName + 'Y');
        this.weekObj = eval('document.' + this.formName + '.' + this.objName + 'W');
    }
    this._initOptions();
    this.setToToday();
    this.adjustDaysInMonth();
}

/* Class Methods */

/**
* Set the date boxes to today's date
*/
function ds_setToToday() {
    this.setDateParts( this.year, this.month, this.date);
}

/**
* Set the date boxes to specific date
* @param string dateStr 'YYYYMMDD'
*/
function ds_setDate(dateStr) {
    var y, m, d, w;
    y = dateStr.substr(0,4);
    m = dateStr.substr(4,2);
    d = dateStr.substr(6,2);
    this.setDateParts( y, m, d);
}

/**
* Set the date boxes to today's date
* @param integer year
* @param integer month
* @param integer day
*/
function ds_setDateParts(year, month, date) {
    this.dayObj[date-1].selected = true;
    this.monthObj[month-1].selected = true;

    for( i=0; i < this.yearObj.length; i++ ) {
        if( this.yearObj[i].value == year )
            this.yearObj[i].selected = true;
    }

    this.adjustDaysInMonth();
}

function ds_getYear() {
    return this.yearObj[this.yearObj.selectedIndex].value;
}

function ds_getMonth() {
    return this.monthObj[this.monthObj.selectedIndex].value;
}

function ds_getDay() {
    return this.dayObj[this.dayObj.selectedIndex].value;
}

function ds_getWeek() {
    return this.weekObj[this.weekObj.selectedIndex].value;
}

/**
* Adjust the 'days' box according to the
* current month and year
*/
function ds_adjustDaysInMonth() {
    Month = this.monthObj[this.monthObj.selectedIndex].value;
    //alert( Month );
    Year = this.yearObj[this.yearObj.selectedIndex].value;
    //alert( Year);
    Day = this.dayObj[this.dayObj.selectedIndex].value;
    //alert(Day);
    Week = this.weekObj[this.weekObj.selectedIndex].value;

    DaysForThisSelection = this._getDaysInMonth(Month, Year);
    WeeksForThisSelection = this._getWeeksInDay(Day, Month, Year);

    //alert(WeeksForThisSelection);

    PrevDaysInSelection = this.dayObj.length;

    this.weekObj.selectedIndex = WeeksForThisSelection;

    if (PrevDaysInSelection > DaysForThisSelection) {
        for (i=0; i<(PrevDaysInSelection-DaysForThisSelection); i++) {
            this.dayObj.options[this.dayObj.options.length - 1] = null
        }
    }
    if (DaysForThisSelection > PrevDaysInSelection) {
        var prevLastDay = this.dayObj.options.length;
        for( i = prevLastDay+1; i <= DaysForThisSelection; i++ ) {
            var newOption = new Option( i, i );
            var optionsColl = this.dayObj.options;
            optionsColl[optionsColl.length] = newOption;
        }
    }

    if (this.dayObj.selectedIndex < 0)
        this.dayObj.selectedIndex == 0;
}

/* Private Methods */

function ds_initOptions() {
    this._writeYearOptions();
    this._writeMonthOptions();
    this._writeDayOptions();
    this._writeWeekOptions();
}

function ds_getWeeksInDay(d, m, y) {

    var mydate = new Date();
    mydate.setYear(y);
    mydate.setMonth(m-1);
    mydate.setDate(d);
    var dayOfWeek = mydate.getDay();

    return dayOfWeek;
}

function ds_getDaysInMonth(m, y) {
    monthdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    if (m != 2) {
        return monthdays[m];
    } else {
        return ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0 ? 29 : 28);
    }
}

function ds_writeYearOptions() {
    for( i=(this.year-this.yearComboRange); i<=(this.year+this.yearComboRange); i++ ) {
        var newOption = new Option( i, i );
        var optionsColl = this.yearObj.options;
        optionsColl[optionsColl.length] = newOption;
    }
}

function ds_writeMonthOptions() {
    for( i=1; i <= 12; i++ ) {

        if(i >0 && i < 10) {
            j = '0'+i;
        } else {
            j= i;
        }

        //var newOption = new Option( this.monthNames[i], i );

        var newOption = new Option( this.monthNames[i], j );
        var optionsColl = this.monthObj.options;
        optionsColl[optionsColl.length] = newOption;
    }
}

function ds_writeDayOptions() {
    for( i=1; i <= 31; i++ ) {

        if(i >0 && i < 10) {
            j = '0'+i;
        } else {
            j= i;
        }

        //var newOption = new Option( j, i );

        var newOption = new Option( j, j);
        var optionsColl = this.dayObj.options;
        optionsColl[optionsColl.length] = newOption;
    }
}

function ds_writeWeekOptions() {
    for( i=0; i <= 6; i++ ) {
        var newOption = new Option( this.weekNames[i], i );
        var optionsColl = this.weekObj.options;
        optionsColl[optionsColl.length] = newOption;
    }
}

//õ ǰ ֹϱ
function selectbuy_action(nexturl,nexturl2,basket_type,fobj) {

var res;
//if(nexturl2) res = nexturl2.'&redirect_url='+ nexturl +'&basket_type='+ basket_type;
//Else res = nexturl+ '&basket_type='+basket_type;
	res = nexturl +'?basket_type='+ basket_type;

	var prd_no ='';
	var token = '';
	var hobj = fobj['sBasketPidtCur'];
	if (!hobj) return;
	try {
		var str_param = '&mode=order_product_mask&nexturl='+nexturl+'&nexturl2='+nexturl2+'&basket_type='+basket_type+'&is_prd_no=' + hobj.value;

		//ó function, Ķ, method, ȣ, true, true)
		sendRequest( send_selectbuy, str_param, 'POST', 'basket_ajax.php', false, true ) ;
		return;
	}catch(e){
		//document.location.href=res;
	}
	
}
function send_selectbuy(oj){

	var res = oj.responseText;

	if (res){
		//document.location.href=res;
	}
	return;
}


//	ֹ  ֹ  
function order_sel_delete() {

	var doc	=	document.getElementsByName('chk_order_cancel_list');
	var tmp;

	//	  div  div_order_cancel_list  Ѵٸ innerHTML  ٽ  غ Ѵ
	if (document.getElementById('div_order_cancel_list')) {

		var div	=	document.getElementById('div_order_cancel_list');
		div.innerHTML	=	"";

	} else {

		var div	=	document.createElement("div");
		div.id	=	'div_order_cancel_list';
	}

	var cancel_list;
	tmp	=	"";
	for (var i = 0 ; i < doc.length ; i++) {

		//	ش ü õǾִ Ȯ
		if (doc[i].checked) {

			tmp	+=	doc[i].value + ',';
		}
	}

	//	 ʿ , ڸ ش
	tmp	=	tmp.substring(0,(tmp.length-1));

	var html	=	"<div style='display:none;border:1px solid red'>"
				+	"	<form action='/front/php/basket.php' method='post' name='frm_order_cancel_list'>"
				+	"		<input type='hidden' name='checked_product' value='"+ tmp +"'>"
				+	"		<input type=hidden name=command value=select_buy_basket>"
				+	"	</form>"
				+	"<div>";

	div.innerHTML	=	html;

	document.body.appendChild(div);
	document.getElementsByName('frm_order_cancel_list')[0].submit();
}


function decryptSubmit_Complete(output) {

    var output = decodeURIComponent(output);

    if( AuthSSLManager.isError(output) == true ) {
        alert(output);
        return;
    }

    var parseStr = AuthSSLManager.unserialize(output);
    
    var hFrm = document.frm;
    hFrm.oname.value = parseStr.name;
    hFrm.ozipcode1.value = parseStr.ozipcode1;
    hFrm.ozipcode2.value = parseStr.ozipcode2;
    hFrm.oaddr1.value = parseStr.addr1;
    hFrm.oaddr2.value = parseStr.addr2;
    hFrm.ophone1_1.value = parseStr.ophone1_1;
    hFrm.ophone1_2.value = parseStr.ophone1_2;
    hFrm.ophone1_3.value = parseStr.ophone1_3;
    hFrm.ophone2_2.value = parseStr.ophone2_2;
    hFrm.ophone2_3.value = parseStr.ophone2_3;
    hFrm.oemail.value = parseStr.email;
	
    FrontComm.unsetLoding();
}


/**
 * ȣȭ û
 */
function encryptSubmit() 
{
       AuthSSLManager.weave({
               // encrypt / decrypt
               'auth_mode': 'encrypt'
               // Ʈ ̵ Ȥ ڽ name
               , 'aEleId': ['oname', 'ozipcode1', 'ozipcode1', 'ophone1_1', 'ophone1_2', 'ophone1_3', 'ophone2_1', 'ophone2_2' ,' ophone2_3', 'oemail', 'rname', 'rzipcode1', 'rzipcode2', 'raddr1', 'raddr2', 'rphone1_1', 'rphone1_2', 'rphone1_3', 'rphone2_1', 'rphone2_2', 'rphone2_3']
               // callback function-name
               , 'auth_callbackName': 'encryptSubmit_Complete'
       });
}

/**
 * callback
 * @param String output
 */
function encryptSubmit_Complete(output) {
    var oBjencode_str = document.createElement("input");
    oBjencode_str.name = "encode_str";
    oBjencode_str.id = "encode_str";
    oBjencode_str.type = "hidden";
    document.frm.appendChild(oBjencode_str);
 
       if( AuthSSLManager.isError(output) == true ) {
               alert(" ȣȭ . ڿ  ּ.");
               return false;
       }
       document.getElementById('encode_str').value = output;
    frm.submit();
}



var OldOrderFormJS = {
    initBasic : function ()
    {
        this.hForm = document.frm ;
        this.bIsInit = true ;
    },
    addrRecvFromBuyerForm : function ( bIsSet )
    {
        if ( !this.bIsInit ) this.initBasic() ;
        if ( bIsSet ) {
            this.addrRecvUpdate(
                this.hForm.oname.value,
                this.hForm.ozipcode1.value, this.hForm.ozipcode2.value, 
                this.hForm.oaddr1.value, this.hForm.oaddr2.value,
                this.hForm.ophone1_1.value, this.hForm.ophone1_2.value, this.hForm.ophone1_3.value, 
                this.hForm.ophone2_1.value, this.hForm.ophone2_2.value, this.hForm.ophone2_3.value
            ) ;
        } else {
            this.addrRecvReset() ;
        }
    },
    addrRecvReset : function ()
    {
        if ( !this.bIsInit ) this.initBasic() ;
        this.addrRecvUpdate(
            '',
            '', '', 
            '', '', 
            '', '', '', 
            '', '', ''
        ) ;
    },
    addrRecvUpdate : function ()
    {
        if ( !this.bIsInit ) this.initBasic() ;
        var iCnt = 0 ;
        this.hForm.rname.value = arguments[iCnt++] ;
        this.hForm.rzipcode1.value = arguments[iCnt++] ;
        this.hForm.rzipcode2.value = arguments[iCnt++] ;
        this.hForm.raddr1.value = arguments[iCnt++] ;
        this.hForm.raddr2.value = arguments[iCnt++] ;
        this.hForm.rphone1_1.value = arguments[iCnt++] ;
        this.hForm.rphone1_2.value = arguments[iCnt++] ;
        this.hForm.rphone1_3.value = arguments[iCnt++] ;
        this.hForm.rphone2_1.value = arguments[iCnt++] ;
        this.hForm.rphone2_2.value = arguments[iCnt++] ;
        this.hForm.rphone2_3.value = arguments[iCnt++] ;
        this.addrRecvUpdateShipFeeReq() ;
    },
    addrRecvUpdateShipFeeReq : function ()
    {
        if ( !this.bIsInit ) this.initBasic() ;
        var shipfee_ifr = document.getElementById('shipfee_calc');
        shipfee_ifr.src = '/front/php/set_shipfee.php?basket_type=' + this.hForm.basket_type.value + '&zipcode=' +  this.hForm.rzipcode1.value + '-' + this.hForm.rzipcode2.value;
        try {
            shipfee_ifr.location.reload();
        } catch(e) {}
    },
    addrRecvOpenLog : function ()
    {
        var wObj = window.open( '/front/php/dlv_addr/dlv_addr.php?sMode=G', 'addrRecvLog','height=700px,width=817px,scrollbars=yes,resizable=yes' ) ;
        wObj.focus();
    },
    addrRecvFromLog : function ()
    {
        if ( !this.bIsInit ) this.initBasic() ;
        var iCnt = 0 ;
        document.getElementsByName( 'sameaddr' )[1].checked = true ;
        this.addrRecvUpdate(
            arguments[iCnt++],
            arguments[iCnt++], arguments[iCnt++], 
            arguments[iCnt++], arguments[iCnt++],
            arguments[iCnt++], arguments[iCnt++], arguments[iCnt++],
            arguments[iCnt++], arguments[iCnt++], arguments[iCnt++]
        ) ;
    }
}
//Ȯϼ ġȯ
function replaceKRCP949(str) {
    str = str.replace(//g, "");
    str = str.replace(//g, "");
    str = str.replace(//g, "");

    return str;
}

function setGiftDisplay(sFlag)
{
    if (sFlag == 'T') {
        if (document.getElementById('trCardImgSel').delflag == 'T') {
            document.getElementById('trCardImgSel').style.display = 'block';
        }
        if (document.getElementById('trGiftMsg').delflag == 'F') {
            document.getElementById('trGiftMsg').style.display = 'block';
        }
        if (document.getElementById('trGiftAttr').delflag == 'T') {
            document.getElementById('trGiftAttr').style.display = 'block';
        }
    } else {
        document.getElementById('trCardImgSel').style.display = 'none';
        document.getElementById('trGiftMsg').style.display = 'none';
        document.getElementById('trGiftAttr').style.display = 'none';
    }
}

function selCardImg(node)
{
    iGiftCard.location.href = '/front/php/gift_bg_sel.php';
    document.getElementById('divGiftCard').style.top = node.clientY+document.body.scrollTop;
    document.getElementById('divGiftCard').style.display='block';
}

function openGiftFile(node)
{
    iGiftFile.location.href = '/front/php/gift_file.php';
    document.getElementById('divGiftFile').style.top = node.clientY+document.body.scrollTop;
    document.getElementById('divGiftFile').style.display='block';
}

function ckGiftCardLen(sValue,iMaxLen)
{
    if (sValue.length > iMaxLen) {
        alert('ִ Է±ڼ ʰǾϴ.');
        document.getElementById('sGiftMsg').value = document.getElementById('sGiftMsg').value.substr(0,iMaxLen);
    }
    document.getElementById('sGiftCardLen').innerHTML = document.getElementById('sGiftMsg').value.length;
}
function setNaverPoint()
{
    try {
        if (document.frm.np_use.checked == false || set_total_price() == false) {/// 
            document.getElementById('npReqTxId').value = "";
            document.getElementById('npUseAmt').value = 0;
            document.getElementById('npBalanceAmt').value = 0;
            document.getElementById('npSaveRate').value = 0;
            document.getElementById('npSaveRateAdd').value = 0;
            document.getElementById('npSig').value = "";
        }
        var sNpReqTxId = document.getElementById('npReqTxId').value;
        var iNpUseAmt = parseFloat(document.getElementById('npUseAmt').value);
        var iNpBalanceAmt = parseFloat(document.getElementById('npBalanceAmt').value);
        var iNpSaveRate = parseFloat(document.getElementById('npSaveRate').value);
        var iNpSaveRateAdd = parseFloat(document.getElementById('npSaveRateAdd').value);
        var iNpSaveRateTotal = iNpSaveRate + iNpSaveRateAdd;
        document.getElementById('divNvPointUse').style.display = 'none';
        document.getElementById('divNvPointSave').style.display = 'none';
        document.getElementById('divNvPointOpr').style.display = 'none';

        document.getElementById('divNvPointBtnAdd').style.display = 'none';
        document.getElementById('divNvPointBtnMod').style.display = 'none';

        if (iNpUseAmt > 0 && iNpSaveRate > 0) {//& opr
            document.getElementById('divNvPointOpr').style.display = 'inline';
        }
        if (iNpUseAmt > 0 || iNpSaveRateTotal > 0) {
            document.getElementById('divNvPointBtnMod').style.display = 'inline';
        } else {
            document.getElementById('divNvPointBtnAdd').style.display = 'inline';
        }
        if (iNpSaveRateTotal > 0) {//
            document.getElementById('divNvPointSave').style.display = 'inline';
            document.getElementById('txt_np_save').innerHTML = document.getElementById('ex_tx_np_save').innerHTML.replace("[np_rate]", iNpSaveRateTotal);
        }
        if (iNpUseAmt > 0) {//
            document.getElementById('divNvPointUse').style.display = 'inline';
            var sTmp = document.getElementById('ex_tx_np_use').innerHTML;
            document.getElementById('txt_np_use').innerHTML = sTmp.replace("[np_use]", number_format(iNpUseAmt));
        }
    } catch (e) {
    }
}

