function MakePayValue( pValue )
{
    var strValue = new String( pValue );
    var sLen = strValue.length;
    var sValue = "";
    var sVal3  = "";

    if ( sLen < 3 )
        return strValue;

    var iCnt = 0;
    for ( var i = sLen; i > 0 ; i-- ) {

        sValue = sValue + strValue.substring( i-1, i );

        if ( ++iCnt == 3 && i > 1 ) {
            sValue = sValue + ',';
            iCnt = 0;
        }
    }

    var sVal2 = new String( sValue );

    for ( i = sVal2.length ; i > 0; i-- ) {
        sVal3 = sVal3 + sVal2.substring( i-1, i );
    }

    return ( sVal3 );
}

function OnLoadInit()
{
	OnUpdateValue( document._PointShopAgentApplForm );
}

function OnApplySubmit( objForm )
{

	if ( CheckValidate( objForm ) ) {

		/**
		if ( !objForm.AgreeYN.status ) {
			alert("¾à°ü¿¡ µ¿ÀÇÇÏ½Ã¸é '¾à°ü¿¡ µ¿ÀÇÇÕ´Ï´Ù' ¸¦ Ã¼Å©ÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù");
			return;
		}
		**/

		if (objForm.shCheckMethod[0].status || objForm.shCheckMethod[2].status ) { // credit card 
		//if (objForm.shCheckMethod[0].status ) { // credit card 
			CheckPayment( objForm );
		} 
		else 
		{
			OnCheckSubmit( objForm.vStoreDomainMain.value, 0, 0 );
		}

//		OnCheckSubmit( objForm.vStoreDomainMain.value, 0, 0 );
	}

}

function OnApplySubmitNew( objForm )
{
	if ( CheckValidateNew( objForm ) ) {

		if ( !objForm.AgreeYN.status ) {
			alert("¾à°ü¿¡ µ¿ÀÇÇÏ½Ã¸é '¾à°ü¿¡ µ¿ÀÇÇÕ´Ï´Ù' ¸¦ Ã¼Å©ÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù");
			return;
		}

		objForm.submit();
	}
}

function OnApplyGMSubmit( objForm )
{

	if ( CheckValidate( objForm ) )
	{

		if ( !objForm.AgreeYN.status ) 
		{
			alert("¾à°ü¿¡ µ¿ÀÇÇÏ½Ã¸é '¾à°ü¿¡ µ¿ÀÇÇÕ´Ï´Ù' ¸¦ Ã¼Å©ÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù");
			return;
		}
		objForm.submit();

	}

}


function OnAgreeSubmit( objForm )
{

		if ( objForm.AgreeYN.value ='' ) {
			alert("¾à°ü¿¡ µ¿ÀÇÇÏ½Ã¸é '¾à°ü¿¡ µ¿ÀÇÇÕ´Ï´Ù' ¸¦ Ã¼Å©ÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù");
			return;
	}

}


function OnChangeDomExt( objForm, objThis, nIndex )
{
	if ( objThis.options[nIndex].value == "±âÅ¸" ) {
		alert( "¸ñ·Ï¿¡ ³ª¿Í ÀÖÁö ¾ÊÀº µµ¸ÞÀÎ °æ¿ì, µµ¸ÞÀÎ¸í¿¡ dot(.)À» Æ÷ÇÔÇÏ¿© ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.\n\n¿¹) mydomain.co.jp" );
	}
}

function CheckHanChar1(str) {
	var len=str.value.length;
	for (i=0;i<len;i++) {

		if(str.value.charAt(i)=="'" || str.value.charAt(i)=="%" || str.value.charAt(i)=="\"" || str.value.charAt(i)=="/" || str.value.charAt(i)=="&" || str.value.charAt(i)=="!" ||
		str.value.charAt(i)=="@" || str.value.charAt(i)=="#" || str.value.charAt(i)=="^" || str.value.charAt(i)=="*" || str.value.charAt(i)=="(" || str.value.charAt(i)==")" ||
		str.value.charAt(i)=="=" || str.value.charAt(i)=="+" || str.value.charAt(i)=="~" || str.value.charAt(i)=="$" || str.value.charAt(i)=="_" ||
		str.value.charAt(i)=="|"|| str.value.charAt(i)=="+"|| str.value.charAt(i)==".") {
			alert("Æ¯¼ö¹®ÀÚ( \",',%,&,...)´Â »ç¿ëÇÏÁö ¸¶¼¼¿ä!");
			str.focus();
			return false;
		}
		if(input_check(str.value.charAt(i))==3){
			alert("Æ¯¼ö¹®ÀÚ( \",',%,&,...)¶Ç´Â ÇÑ±Û¾ÆÀÌµðÀ» »ç¿ëÇÏÁö ¸¶¼¼¿ä!\n\n »óÁ¡¾ÆÀÌµð ¹× ±âÅ¸ ¾ÆÀÌµð¿¡ ¾²ÀÌ¹Ç·Î ¿µ¹®À» ¾²½Ã±æ ±ÇÀåÇÕ´Ï´Ù.\n");
			str.select();
			str.focus();
			return false;			
		}
	} 
	return true;
}	

function input_check(check_string)
{
		var char_ASCII = check_string.charCodeAt(check_string.length-1);
		//¼ýÀÚ
		if (char_ASCII >= 48 && char_ASCII <= 57 )
				return 1;
		//¿µ¾î
		else if ((char_ASCII>=65 && char_ASCII<=90)
						|| (char_ASCII>=97 && char_ASCII<=122))
				return 2;
		//Æ¯¼ö±âÈ£
		else if ((char_ASCII>=33 && char_ASCII<=47)
						|| (char_ASCII>=58 && char_ASCII<=64)
						|| (char_ASCII>=91 && char_ASCII<=96)
						|| (char_ASCII>=123 && char_ASCII<=126))
				return 4;
		//ÇÑ±Û
		else if ((char_ASCII >= 12592) || (char_ASCII <= 12687))
				return 3;
		else 
				return 0;
}

function CheckEmpty( objId, nLimit, szErrString ) 
{
	var invalid = " "; 
	if ( objId.value.length < nLimit || objId.value.indexOf(invalid) > -1 ) {
		objId.focus();
		alert( szErrString ); 
		return false;
	}

	return true;
}

/**°áÁ¦ ³Ñ±â±â **/
function OnCheckSubmit( vSaleId, vAuthNo, vTrNo )
{
	var objForm = document._PointShopApplForm;

	//alert( "Thanks!! - submit now! :: " + vSaleId );

	objForm.vSaleId.value     = vSaleId;
	objForm.submit();
}



function getNumber( val )
{
    var cmp    = "0123456789.";
    var ndigit = "";

    for ( var i = 0; i < val.length; i++ ) {
        if (cmp.indexOf(val.charAt(i)) < 0) {
            continue;
        } else {
            ndigit = ndigit + val.charAt(i);
        }
    }

    if ( ndigit.length < 1 )
        return 0;

    return parseInt(ndigit);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
