String.prototype.trim = new Function("return this.replace(/^\\s+|\\s+$/g,'')");

function addLoadEvent(funct) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = funct;
	} else {
		window.onload = function() {
			oldonload();
			funct();
		}
	}
}

function form_chk(form,str)
{ // 필수 입력사항 체크
	var tmp;
	var chk = true;
	arr = str.split('|');
	for(var i=0;i<arr.length;i++){
		chkArr = arr[i].split('/');
		tmp = chkArr[0];
		obj = eval('form.'+tmp);
		if (!chkArr[1]||!obj) continue;
		if (obj.value.trim() == '') {
			//alert(chkArr[1]+'는(은) 필수 입력사항입니다');
			alert(chkArr[1]+'は必須項目です。');
			obj.focus();
			chk = false;
			break;
		}
	}
	return chk;
}

function isNumber(form,str)
{ // 숫자인지 검사
	var tmp;
	var chk = true;
	arr = str.split('|');
	for(var i=0;i<arr.length;i++){
		chkArr = arr[i].split('/');
		tmp = chkArr[0];
		obj = eval('form.'+tmp);
		if(!chkArr[1]||!obj)continue;
		if(isNaN(obj.value)){
			//alert(chkArr[1]+'는(은) 숫자만 입력하세요');
			alert(chkArr[1]+'は半角数字のみ入力してください。');
			obj.focus();
			obj.select();
			chk = false;
			break;
		}
	}
	return chk;
}

function isNum(obj)
{ // 숫자인지 체크
	if(isNaN(obj.value)) {
		//alert("필수 입력사항이며 숫자만 입력가능합니다.");
		alert("必須項目です。数字のみ入力可能です。");
		obj.select();
		obj.focus();
	}
}

function OpenCheckAddr(form_name,zipcode_name1,zipcode_name2,zipcode_value1,zipcode_value2,address_name1,address_name2)
{ // 주소입력 팝업창
	FormName = form_name;
	zipcode1 = zipcode_name1;
	zipcode2 = zipcode_name2;
	zipcode_value1 = zipcode_value1.value;
	zipcode_value2 = zipcode_value2.value;
	var url = "/addr_search.php?form="+FormName+"&newzip_name1="+zipcode1+"&newzip_name2="+zipcode2 + "&newzip_value1=" + zipcode_value1 + "&newzip_value2=" + zipcode_value2 + "&newaddress_name1=" + address_name1 + "&newaddress_name2=" + address_name2 ;
	var win_option = "width=430,height=170,scrollbars=no";
	window.open(url,"ZSerchWin",win_option);
}


function search_zipcode(url, form, zip1, address, address_us)
{ // 우편번호 검색창 띄우기
	var state = "width=500,height=400,scrollbars=1,toolbar=0,status=0,resizable=0,menubar=0,left="+screen.width/5+",top="+screen.height/4;
	var url = url + "?formname="+form+"&zipcode="+zip1+"&address="+address+"&address_us="+address_us;
	var win = window.open(url,'SearchAddress',state);
	win.focus();
}

function tab_order(arg,nextname,len) {  // 입력수가 일치하면 다음으로 포커스 주기
	if (arg.value.length==len) {
	   nextname.focus() ;
	   return;
	}
}

function fnDupCheck(mthname)
{ // 아이디 중복 확인 팝업창
	var par="width=200,height=100,location=no";
	if (!document.regist.adminid.value) {
		 //alert("아이디 입력 후 중복 확인을 해주세요");
		 alert("ID入力後、重複確認を行ってください。");
		 document.regist.adminid.focus();
		 return;
	}
	window.open("./mall_regist_dup.php?id="+document.regist.adminid.value+"&storetype="+document.regist.storestyle.value,"DUPCHECK",par);
}

function id_check(id, min_len, max_len)
{ // 아이디 형식 체크
	str = id;
	var temp = str.replace(' ','');
	var MSG = '';

	if(( id.length < min_len ) || ( id.length > max_len ))
	{
		return false;
	}
	str1 = str.toUpperCase();
	for(i=0; i<str1.length; i++){
		if (str1.charAt(i) == " "){
			return false;
		}
		else if (((str1.charAt(i) < "A") || (str1.charAt(i) > "Z"))
		     && ((str1.charAt(i) < "0") || (str1.charAt(i) > "9"))){

			return false;
		 }
	}
	str2 = str.toLowerCase();
	id = str2;
	return true;
}

function id_check2(id, min_len, max_len)
{ // 아이디 형식 체크
	var patten = /^([-_a-zA-Z0-9@.])+$/;
	if(( id.length < min_len ) || ( id.length > max_len )) {
		return false;
	}
	if(!patten.test(id)){
		return false;
	} else {
		return true;
	}
}


function password_check(password, min_len, max_len)
{ // 비밀번호 형식 체크
	str = password;
	var temp = str.replace(' ','');
	var MSG = '';
	var Flag = '0';

	if(( password.length < min_len ) || ( password.length > max_len ))
	{
		return false;
	}

	str2 = str.toLowerCase();
	id = str2;
	return true;
}

function JuminCheck(form, jumin1 , jumin2)
{ // 주민번호 체크
	errfound = false;
	var str_jumin1 = eval('form.' + jumin1 + '.value');
	var str_jumin2 = eval('form.' + jumin2 + '.value');
	var jumin = str_jumin1 + str_jumin2;
	var idadd = "234567892345";
	var i;
	var str;
	var jumin_tot=0;
	var jumin_yn=0;
	var s_month=parseInt(str_jumin1.substr(2, 2), 10);
	var s_day=parseInt(str_jumin1.substr(4, 2), 10);

	if(jumin.length != 13) return errfound;
	for(i=0; i<13 ; i++){
		str=jumin.substr(i,1);
		if((str < 0) || (str > 9)) return errfound;
	}
	for (i = 0;i<12 ;i++)
	{
		jumin_tot=jumin_tot+parseInt(jumin.substr(i,1), 10)*parseInt(idadd.substr(i,1), 10);
	}
	jumin_yn = 11-(jumin_tot%11);
	if(jumin_yn>9) jumin_yn=jumin_yn-10;
	if((str_jumin2.substr(0, 1) > 4) || (str_jumin2.substr(0, 1) < 1))
	{
		return errfound;
	}
	if(jumin_yn != str_jumin2.substr(6,1))
	{
		return errfound;
	}
	if(1 > s_month || s_month > 12) return errfound;
	if(1 > s_day || s_day > 31) return errfound;
	errfound=true;
	return errfound;
}


function chkSpace(strValue)
{ // 공백 여부 체크
    var flag=true;
    if (strValue!="") {
      for (var i=0; i < strValue.length; i++) {
		if (strValue.charAt(i) != " ") {
		  flag=false;
		  break;
		}
      }
    }
    return flag;
}

function blank_check(Btemp)
{ // 공백 개수 구하기
	var count=0;
	for(i=0 ; i < Btemp.length ; i++){
		var b = Btemp.substring(i,i+1);
		if (b != " ") continue;
		++count;
	}
	return count;
}

function length_check(Ltemp)
{ // 문자열 길이 구하기
	var temp_length = Ltemp.length;
 	return temp_length;
}

function emailCheck(obj, value)
{ // 메일 형식 체크
	var patten = /^([-_a-zA-Z0-9])+@([_a-zA-Z0-9-])+\.([_a-zA-Z0-9\.])+$/;
	if(value){
		if(!patten.test(value)){
			//alert("작성하신 e-mail 형식이 올바르지 못합니다.\n\nex)webmaster@bidbuy.co.jp");
			alert("作成したe-mail形式が正しくありません。\n\nex)webmaster@bidbuy.co.jp");
			obj.select();
			obj.focus();
		}
	}
}


function emailCheck2(obj, value)
{ // 메일 형식 체크
	var patten = /^([-_\.a-zA-Z0-9])+@([-_a-zA-Z0-9])+\.([-_a-zA-Z0-9\.])+$/;
	if(!value) return false;
	if(!patten.test(value)){
		return false;
	}
	return true;
}


function homepageCheck(obj, str)
{ // 홈페이지 형식 체크
	if(str.length > 7){
		if(str.search(/^http[a-z]*:\/\/([a-z0-9-_])+\.([-a-z0-9_\.])*([0-9a-z\/\~])+$/i) == -1){ // i : 대소문자 구분안함
			//alert("작성하신 homepage 형식이 올바르지 못합니다.\n\nex) http://www.bidbuy.co.jp");
			alert("作成したホームページの形式が正しくありません。\n\nex) http://www.bidbuy.co.jp");
			obj.select();
			obj.focus();
		}
	}
	else obj.value = "";
}

function popupWindow(url,width,height,windowname,scrollbar)
{ // open widdow
	if(scrollbar == ''){ scrollbar = 'yes'; }
	wleft = (screen.width-width)/2;
	wtop = (screen.height-height)/2;
	opt = 'width='+width+',height='+height+',left='+wleft+',top='+wtop+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbar + ',resizable=yes'
	win = window.open(url,windowname,opt);
	//window.focus = win;
	win.focus();
}

function popupWindow2(url, windowname, width, height,  wleft, wtop, scrollbar, resizable, status)
{ // open widdow2
	if(scrollbar == ''){ scrollbar = 'no'; }
	if(resizable == ''){ resizable = 'no'; }
	if(status == ''){ status = 'no'; }
	if(wleft == '') { wleft = (screen.width-width)/2; }
	if(wtop == '') { wtop = (screen.height-height)/2; }
	opt = 'width='+width+',height='+height+',left='+wleft+',top='+wtop+',scrollbars=' + scrollbar + ',resizable='+ resizable +', status='+ status +'toolbar=no,location=no,directories=no,menubar=no,'
	win = window.open(url,windowname,opt);
	window.focus = win;
}

function opener_page_open(url) {
	if(parent.opener.closed) {
		window.open(url).focus();
	}else {
		//alert(opener.location);
		parent.opener.location = url;
		parent.opener.focus();
	}
}


// checkbox 전체선택 , 선택해제
function actCheckBox(form, option, target)
{	// checkBox on/off
	var ele_length = form.elements.length ;
	for(i=0;i < ele_length;i++){
		var ele_name = form.elements[i].name ;
		var ele_type = form.elements[i].type ;
		var ele_disabled = form.elements[i].disabled ;
		//alert(ele_disabled);return false;
		if(ele_name.search(/target/i) == -1 && ele_type == "checkbox"){
			//alert(target + ' ' + ele_name + ' ' + ele_name.search(/target/i));
			if(ele_disabled == false) { // disabled 처리된 것은 동작하지 않는다.
				if(option  == "on"){
					form.elements[i].checked = true;
				}else{
					form.elements[i].checked = false;
				}
			}
		}
	}
	return false;
}


function checkLength(obj , len){
	if(obj.value != "" && obj.value.length != len){
		//alert('입력개수가 올바르지 못합니다.');
		alert('入力個数が正しくありません。');
		obj.focus();
		obj.select();
	}
}


function getRadioValue(form , obj_name){
	obj = eval('form.' + obj_name);
	str = '';
	if(!obj.length){	 // redio 버튼이 1개인 경우
		if(obj.checked == true){
			str = obj.value;
		}
	}
	else{				// radio 버튼이 2개 이상인 경우
		for(i=0 ; i<obj.length ; i++){
			if(eval('obj[' + i + '].checked') == true){
				str = eval('obj[' + i + '].value');
				break;
			}
		}
	}
	return str;
}


function resizeWin(width , height){
	//alert('test');
	self.resizeTo(width , height);
}


function resizeImage(name, user_width, user_height)
{	// image resize
	var width = eval('document.all.'+name+'.width');
	var height = eval('document.all.'+name+'.height');
	var diff_width = width - user_width;
	var diff_height = height - user_height;
	if(width < user_width && height < user_height){
		//eval('document.all.'+name+'.width = ' + width);
		//eval('document.all.'+name+'.height = ' + height);
	}
	else if(diff_width > diff_height){
		user_size = height * (user_width / width);
		eval('document.all.'+name+'.width = ' + user_width);
		eval('document.all.'+name+'.height = ' + user_size);
	}
	else if(diff_width < diff_height){
		user_size = width * (user_height / height);
		eval('document.all.'+name+'.width = ' + user_size);
		eval('document.all.'+name+'.height = ' + user_height);
	}
}


function is_selected(form , total_cnt , obj){
	if (eval('form.' + total_cnt) == ""){
		//alert("검색된 코드가 없습니다.");
		alert("選択したコードがありません。");
		return false;
	}
    var j = 0;
    for (var i = 0; i <eval('form.' + total_cnt + '.value') ; i++){
        if (eval('form.' + obj + i + '.checked') == true){
            j++;
        }
    }
    if (j == 0){
        //alert("항목을 선택 하십시요.");
        alert("項目を選択してください。");
        return false;
    }
	return true;
}



// 선택된 개수를 return 한다.
function is_selected2(form , total_cnt , obj){
	if (eval('form.' + total_cnt) == ""){
		return 0;
	}
    var j = 0;
    for (var i = 0; i <eval('form.' + total_cnt + '.value') ; i++){
        if (eval('form.' + obj + i + '.checked') == true){
            j++;
        }
    }
	return j;
}



// 반각 체크
// if ( !checkisHankaku(......)) { alert('전각이 포함되어 있습니다.'); return; }
function checkIsHankaku(str)
{
	var iCount;
	var sTemp;
	for (iCount=0;iCount<str.length;iCount++) {
		sTemp = escape(str.charAt(iCount));
		if (sTemp.length >= 4) return false;
	}
	return true;
}


function form_chk_hankaku(form,str)
{ // 반각체크
	var tmp;
	var chk = true;
	arr = str.split('|');
	for(var i=0;i<arr.length;i++){
		chkArr = arr[i].split('/');
		tmp = chkArr[0];
		obj = eval('form.'+tmp);
		if(!chkArr[1]||!obj)continue;

		if(!checkIsHankaku(obj.value)){
			//alert('반각으로 입력해주세요');
			alert("半角で入力して下さい。");
			obj.focus();
			chk = false;
			break;
		}
	}
	return chk;
}



// 경매 대행수수료 계산
function get_agent_commission(price, quan, grade)
{
	if(price == '') price = 0;
	if(quan == '') quan = 0;
	if(grade == '') grade = 0;

	//회원 등급 => 1:신입 2:실버 3:골드
	sum_price = price * quan;
	com = 0;

	// 금액이 0 인 경우는 대행료는 없다.
	if(sum_price == 0) return com;

	if(sum_price < 100)
	{
		switch(parseInt(grade))
		{
			case 1 : com = 18; break;
			case 2 : com = 15; break;
			case 3 : com = 12; break;
			case 4 : com = 10; break;
			case 5 : com = 8; break;
			case 9 : com = 0; break;
		}
	}
	else
	{
		switch(parseInt(grade))
		{
			case 1 : com = Math.round(sum_price * 18) / 100; break;
			case 2 : com = Math.round(sum_price * 15) / 100; break;
			case 3 : com = Math.round(sum_price * 12) / 100; break;
			case 4 : com = Math.round(sum_price * 10) / 100; break;
			case 5 : com = Math.round(sum_price * 8) / 100; break;
			case 9 : com = 0; break;
		}
	}

	return com;
}


// 구매 대행수수료 계산
function get_buying_agent_commission(price, quan, grade)
{
	if(price == '') price = 0;
	if(quan == '') quan = 0;
	if(grade == '') grade = 0;

	var argv = get_buying_agent_commission.arguments;
	var argc = get_buying_agent_commission.arguments.length;
	var country_cd = (argc > 3) ? argv[3] : 'US';

	//회원 등급 => 1:신입 2:실버 3:골드
	sum_price = price * quan;
	com = 0;

	// 금액이 0 인 경우는 대행료는 없다.
	if(sum_price == 0) return com;

	if(country_cd == 'KR')
	{
		if(sum_price < 100000)
		{
			switch(parseInt(grade))
			{
				case 1 : com = 12000; break;
				case 2 : com = 11000; break;
				case 3 : com = 10000; break;
				case 4 : com = 9000; break;
				case 5 : com = 8000; break;
				case 9 : com = 0; break;
			}
		}
		else
		{
			switch(parseInt(grade))
			{
				case 1 : com = Math.round(sum_price * 0.12); break;
				case 2 : com = Math.round(sum_price * 0.11); break;
				case 3 : com = Math.round(sum_price * 0.10); break;
				case 4 : com = Math.round(sum_price * 0.10); break;
				case 5 : com = Math.round(sum_price * 0.8); break;
				case 9 : com = 0; break;
			}
		}
	}
	else
	{
		if(sum_price < 100)
		{
			switch(parseInt(grade))
			{
				case 1 : com = 18; break;
				case 2 : com = 15; break;
				case 3 : com = 12; break;
				case 4 : com = 10; break;
				case 5 : com = 8; break;
				case 9 : com = 0; break;
			}
		}
		else
		{
			switch(parseInt(grade))
			{
				case 1 : com = Math.round(sum_price * 18) / 100; break;
				case 2 : com = Math.round(sum_price * 15) / 100; break;
				case 3 : com = Math.round(sum_price * 12) / 100; break;
				case 4 : com = Math.round(sum_price * 10) / 100; break;
				case 5 : com = Math.round(sum_price * 8) / 100; break;
				case 9 : com = 0; break;
			}
		}
	}

	return com;
}


// 해외배송대행 대행수수료 계산
function get_transport_agent_commission(service, price, quan, grade)
{
	if(price == '') price = 0;
	if(quan == '') quan = 0;
	if(grade == '') grade = 0;
	if(service == '') service = 2;

	//회원 등급 => 0:신입 1:실버 2:골드 3:프리미엄
	sum_price = price * quan;
	com = 0;

	// 금액이 0 인 경우는 대행료는 없다.
	if(sum_price == 0) return com;

	if(sum_price < 100)
	{
		switch(parseInt(grade))
		{
			case 1 : com = 10; break;
			case 2 : com = 8; break;
			case 3 : com = 8; break;
			case 4 : com = 6; break;
			case 5 : com = 6; break;
			case 9 : com = 0; break;
		}
	}
	else
	{
		switch(parseInt(service))
		{
			//case 1 : com = Math.round(sum_price * 10) / 100; break; // 결제만
			case 2 : // 배송만
				switch(parseInt(grade))
				{
					case 1 : com = Math.round(sum_price * 10) / 100; break;
					case 2 : com = Math.round(sum_price * 8) / 100; break;
					case 3 : com = Math.round(sum_price * 8) / 100; break;
					case 4 : com = Math.round(sum_price * 6) / 100; break;
					case 5 : com = Math.round(sum_price * 6) / 100; break;
					case 9 : com = 0; break;
				}
			break;
			//case 3 : com = get_agent_commission(price, quan, grade); break; // 결제+배송
			//case 4 : com = Math.round(sum_price * 15) / 100; break; // 기타
		}
	}

	return com;
}


function get_escrow_fee(is_use, price, quan)
{
	if(is_use == '') is_use = 'N';
	if(price == '') price = 0;
	if(quan == '') quan = 1;
	if(is_use == 'N' || is_use == 'D') return 0;
	if(price == 0) return 0;

	var argv = get_escrow_fee.arguments;
	var argc = get_escrow_fee.arguments.length;
	var country_cd = (argc > 3) ? argv[3] : 'US';

	var escrow = 0;
	switch(country_cd)
	{
		case 'KR' : escrow = 0; break;
		default : escrow = Math.round(price * quan * 5) / 100; break;
	}

	return escrow;
}


function calc_delivery_fee(d_way , d_weight)
{
	fee = 0.0;
	if (d_way == '') return 0;
	if (d_weight == '' || d_weight <= 0) return 0;

	var argv = calc_delivery_fee.arguments;
	var argc = calc_delivery_fee.arguments.length;
	var country_cd = (argc > 2) ? argv[2] : 'US';

	if (country_cd == 'KR') {
		switch (d_way) {
			case 'E' :
				if (d_weight <= 0.5) fee = 14300;
				else if (d_weight <= 1) fee = 15700;
				else if (d_weight <= 1.5) fee = 17700;
				else if (d_weight <= 2) fee = 20100;
				else if (d_weight <= 2.5) fee = 21200;
				else if (d_weight <= 3) fee = 22200;
				else if (d_weight <= 3.5) fee = 23300;
				else if (d_weight <= 4) fee = 24300;
				else if (d_weight <= 4.5) fee = 25400;
				else if (d_weight <= 5) fee = 26400;
				else if (d_weight <= 5.5) fee = 27500;
				else if (d_weight <= 6) fee = 28500;
				else if (d_weight <= 6.5) fee = 29500;
				else if (d_weight <= 7) fee = 30600;
				else if (d_weight <= 7.5) fee = 31600;
				else if (d_weight <= 8) fee = 32700;
				else if (d_weight <= 8.5) fee = 33700;
				else if (d_weight <= 9) fee = 34800;
				else if (d_weight <= 9.5) fee = 35800;
				else if (d_weight <= 10) fee = 36900;
				else if (d_weight <= 10.5) fee = 37900;
				else if (d_weight <= 11) fee = 39000;
				else if (d_weight <= 11.5) fee = 40000;
				else if (d_weight <= 12) fee = 41000;
				else if (d_weight <= 12.5) fee = 42100;
				else if (d_weight <= 13) fee = 43100;
				else if (d_weight <= 13.5) fee = 44200;
				else if (d_weight <= 14) fee = 45200;
				else if (d_weight <= 14.5) fee = 46300;
				else if (d_weight <= 15) fee = 47300;
				else if (d_weight <= 15.5) fee = 48400;
				else if (d_weight <= 16) fee = 49400;
				else if (d_weight <= 16.5) fee = 50400;
				else if (d_weight <= 17) fee = 51500;
				else if (d_weight <= 17.5) fee = 52500;
				else if (d_weight <= 18) fee = 53600;
				else if (d_weight <= 18.5) fee = 54600;
				else if (d_weight <= 19) fee = 55700;
				else if (d_weight <= 19.5) fee = 56700;
				else if (d_weight <= 20) fee = 57800;
				else if (d_weight <= 20.5) fee = 58800;
				else if (d_weight <= 21) fee = 59900;
				else if (d_weight <= 21.5) fee = 60900;
				else if (d_weight <= 22) fee = 61900;
				else if (d_weight <= 22.5) fee = 63000;
				else if (d_weight <= 23) fee = 64000;
				else if (d_weight <= 23.5) fee = 65100;
				else if (d_weight <= 24) fee = 66100;
				else if (d_weight <= 24.5) fee = 67200;
				else if (d_weight <= 25) fee = 68100;
				else if (d_weight <= 25.5) fee = 69100;
				else if (d_weight <= 26) fee = 70000;
				else if (d_weight <= 26.5) fee = 71000;
				else if (d_weight <= 27) fee = 71900;
				else if (d_weight <= 27.5) fee = 72900;
				else if (d_weight <= 28) fee = 73800;
				else if (d_weight <= 28.5) fee = 74800;
				else if (d_weight <= 29) fee = 75700;
				else if (d_weight <= 29.5) fee = 76700;
				else if (d_weight <= 30) fee = 77600;
				else {
					//alert('EMS는 66 파운드(30 Kg)를 넘을수 없습니다.');
					alert('EMSは66パウンド(30 Kg)を超えることができません。');
					fee = 0;
				}
				break;
			default :
				return 0;
		}
	}
	else {
		// 1 파운드 = 0.454 Kg
		// 용적 중량 = 종 x 횡 x 높이 (인치) ÷ 166
		switch (d_way) {
			case 'E' : // EMS
				if (d_weight <= 1) fee = 31.50;
				else if (d_weight <= 2) fee = 36.25;
				else if (d_weight <= 3) fee = 41.00;
				else if (d_weight <= 4) fee = 45.75;
				else if (d_weight <= 5) fee = 50.50;
				else if (d_weight <= 6) fee = 55.25;
				else if (d_weight <= 7) fee = 60.00;
				else if (d_weight <= 8) fee = 64.75;
				else if (d_weight <= 9) fee = 69.50;
				else if (d_weight <= 10) fee = 74.25;
				else if (d_weight <= 11) fee = 79.50;
				else if (d_weight <= 12) fee = 84.75;
				else if (d_weight <= 13) fee = 90.00;
				else if (d_weight <= 14) fee = 95.25;
				else if (d_weight <= 15) fee = 100.50;
				else if (d_weight <= 16) fee = 106.25;
				else if (d_weight <= 17) fee = 112.00;
				else if (d_weight <= 18) fee = 117.75;
				else if (d_weight <= 19) fee = 123.50;
				else if (d_weight <= 20) fee = 129.25;
				else if (d_weight <= 21) fee = 135.00;
				else if (d_weight <= 22) fee = 140.75;
				else if (d_weight <= 23) fee = 146.50;
				else if (d_weight <= 24) fee = 152.25;
				else if (d_weight <= 25) fee = 158.00;
				else if (d_weight <= 26) fee = 163.75;
				else if (d_weight <= 27) fee = 169.50;
				else if (d_weight <= 28) fee = 175.25;
				else if (d_weight <= 29) fee = 181.00;
				else if (d_weight <= 30) fee = 186.75;
				else if (d_weight <= 31) fee = 192.50;
				else if (d_weight <= 32) fee = 198.25;
				else if (d_weight <= 33) fee = 204.00;
				else if (d_weight <= 34) fee = 209.75;
				else if (d_weight <= 35) fee = 215.50;
				else if (d_weight <= 36) fee = 221.25;
				else if (d_weight <= 37) fee = 227.00;
				else if (d_weight <= 38) fee = 232.75;
				else if (d_weight <= 39) fee = 238.50;
				else if (d_weight <= 40) fee = 244.25;
				else if (d_weight <= 41) fee = 250.00;
				else if (d_weight <= 42) fee = 255.75;
				else if (d_weight <= 43) fee = 261.50;
				else if (d_weight <= 44) fee = 267.25;
				else if (d_weight <= 45) fee = 273.00;
				else if (d_weight <= 46) fee = 278.75;
				else if (d_weight <= 47) fee = 284.50;
				else if (d_weight <= 48) fee = 290.25;
				else if (d_weight <= 49) fee = 296.00;
				else if (d_weight <= 50) fee = 301.75;
				else if (d_weight <= 51) fee = 307.50;
				else if (d_weight <= 52) fee = 313.25;
				else if (d_weight <= 53) fee = 319.00;
				else if (d_weight <= 54) fee = 324.75;
				else if (d_weight <= 55) fee = 330.50;
				else if (d_weight <= 56) fee = 336.25;
				else if (d_weight <= 57) fee = 342.00;
				else if (d_weight <= 58) fee = 347.75;
				else if (d_weight <= 59) fee = 353.50;
				else if (d_weight <= 60) fee = 359.25;
				else if (d_weight <= 61) fee = 365.00;
				else if (d_weight <= 62) fee = 370.75;
				else if (d_weight <= 63) fee = 376.50;
				else if (d_weight <= 64) fee = 382.25;
				else if (d_weight <= 65) fee = 388.00;
				else if (d_weight <= 66) fee = 393.75;
				else
				{
					//alert('EMS는 66 파운드(30 Kg)를 넘을수 없습니다.');
					alert('EMSは66パウンド(30 Kg)を超えることができません。');
					fee = 0;
				}
			break;

			case 'H' : // Hanjin
				if (d_weight <= 1	) fee = 18.50;
				else if (d_weight <= 2) fee = 21.00;
				else if (d_weight <= 3) fee = 22.00;
				else if (d_weight <= 4) fee = 24.00;
				else if (d_weight <= 5) fee = 27.00;
				else if (d_weight <= 6) fee = 30.00;
				else if (d_weight <= 7) fee = 32.00;
				else if (d_weight <= 8) fee = 35.00;
				else if (d_weight <= 9) fee = 37.00;
				else if (d_weight <= 10) fee = 39.00;
				else if (d_weight <= 11) fee = 41.00;
				else if (d_weight <= 12) fee = 43.00;
				else if (d_weight <= 13) fee = 45.00;
				else if (d_weight <= 14) fee = 47.00;
				else if (d_weight <= 15) fee = 49.00;
				else if (d_weight <= 16) fee = 51.00;
				else if (d_weight <= 17) fee = 53.00;
				else if (d_weight <= 18) fee = 55.00;
				else if (d_weight <= 19) fee = 57.00;
				else if (d_weight <= 20) fee = 59.00;
				else if (d_weight <= 21) fee = 61.00;
				else if (d_weight <= 22) fee = 63.00;
				else if (d_weight <= 23) fee = 64.00;
				else if (d_weight <= 24) fee = 65.00;
				else if (d_weight <= 25) fee = 66.00;
				else if (d_weight <= 26) fee = 67.00;
				else if (d_weight <= 27) fee = 68.00;
				else if (d_weight <= 28) fee = 69.00;
				else if (d_weight <= 29) fee = 70.00;
				else if (d_weight <= 30) fee = 71.00;
				else if (d_weight <= 31) fee = 72.00;
				else if (d_weight <= 32) fee = 73.00;
				else if (d_weight <= 33) fee = 75.00;
				else if (d_weight <= 34) fee = 77.00;
				else if (d_weight <= 35) fee = 79.00;
				else if (d_weight <= 36) fee = 81.00;
				else if (d_weight <= 37) fee = 83.00;
				else if (d_weight <= 38) fee = 85.00;
				else if (d_weight <= 39) fee = 86.00;
				else if (d_weight <= 40) fee = 86.00;
				else if (d_weight <= 41) fee = 88.00;
				else if (d_weight <= 42) fee = 88.00;
				else if (d_weight <= 43) fee = 90.00;
				else if (d_weight <= 44) fee = 90.00;
				else if (d_weight <= 45) fee = 93.00;
				else if (d_weight <= 46) fee = 93.00;
				else if (d_weight <= 47) fee = 96.00;
				else if (d_weight <= 48) fee = 96.00;
				else if (d_weight <= 49) fee = 99.00;
				else if (d_weight <= 50) fee = 99.00;
				else if (d_weight <= 51) fee = 102.00;
				else if (d_weight <= 52) fee = 102.00;
				else if (d_weight <= 53) fee = 102.00;
				else if (d_weight <= 54) fee = 105.00;
				else if (d_weight <= 55) fee = 105.00;
				else {
					//alert('Hanjin 는 55 파운드(25 Kg)를 넘을수 없습니다.');
					alert('韓進宅配は55パウンド(25 Kg)を超えることができません。');
					fee = 0;
				}
			break;

			case 'Y' : // Yamato
				if (d_weight <= 1	) fee = 18.50;
				else if (d_weight <= 2) fee = 21.00;
				else if (d_weight <= 3) fee = 22.00;
				else if (d_weight <= 4) fee = 24.00;
				else if (d_weight <= 5) fee = 27.00;
				else if (d_weight <= 6) fee = 30.00;
				else if (d_weight <= 7) fee = 32.00;
				else if (d_weight <= 8) fee = 35.00;
				else if (d_weight <= 9) fee = 37.00;
				else if (d_weight <= 10) fee = 39.00;
				else if (d_weight <= 11) fee = 41.00;
				else if (d_weight <= 12) fee = 43.00;
				else if (d_weight <= 13) fee = 45.00;
				else if (d_weight <= 14) fee = 47.00;
				else if (d_weight <= 15) fee = 49.00;
				else if (d_weight <= 16) fee = 51.00;
				else if (d_weight <= 17) fee = 53.00;
				else if (d_weight <= 18) fee = 55.00;
				else if (d_weight <= 19) fee = 57.00;
				else if (d_weight <= 20) fee = 59.00;
				else if (d_weight <= 21) fee = 61.00;
				else if (d_weight <= 22) fee = 63.00;
				else if (d_weight <= 23) fee = 64.00;
				else if (d_weight <= 24) fee = 65.00;
				else if (d_weight <= 25) fee = 66.00;
				else if (d_weight <= 26) fee = 67.00;
				else if (d_weight <= 27) fee = 68.00;
				else if (d_weight <= 28) fee = 69.00;
				else if (d_weight <= 29) fee = 70.00;
				else if (d_weight <= 30) fee = 71.00;
				else if (d_weight <= 31) fee = 72.00;
				else if (d_weight <= 32) fee = 73.00;
				else if (d_weight <= 33) fee = 75.00;
				else if (d_weight <= 34) fee = 77.00;
				else if (d_weight <= 35) fee = 79.00;
				else if (d_weight <= 36) fee = 81.00;
				else if (d_weight <= 37) fee = 83.00;
				else if (d_weight <= 38) fee = 85.00;
				else if (d_weight <= 39) fee = 86.00;
				else if (d_weight <= 40) fee = 86.00;
				else if (d_weight <= 41) fee = 88.00;
				else if (d_weight <= 42) fee = 88.00;
				else if (d_weight <= 43) fee = 90.00;
				else if (d_weight <= 44) fee = 90.00;
				else if (d_weight <= 45) fee = 93.00;
				else if (d_weight <= 46) fee = 93.00;
				else if (d_weight <= 47) fee = 96.00;
				else if (d_weight <= 48) fee = 96.00;
				else if (d_weight <= 49) fee = 99.00;
				else if (d_weight <= 50) fee = 99.00;
				else if (d_weight <= 51) fee = 102.00;
				else if (d_weight <= 52) fee = 102.00;
				else if (d_weight <= 53) fee = 102.00;
				else if (d_weight <= 54) fee = 105.00;
				else if (d_weight <= 55) fee = 105.00;
				else {
					//alert('Yamato 는 55 파운드(25 Kg)를 넘을수 없습니다.');
					alert('ヤマトは55パウンド(25 Kg)を超えることができません。');
					fee = 0;
				}
			break;

			default :
				return 0;
		}
	}

	return fee;
}


// 국제배송료 - 연유비·시큐어러티 비용
function calc_delivery_fee2(d_way , d_fee)
{
	fee = 0.0;
	if(d_way == '') return 0;
	if(d_fee == '' || d_fee <= 0) return 0;
	switch(d_way) {
		case 'E' :
			//
		break;
		case 'Y' :
			// 2009-07 : 12.5%
			// 2009-08 : 16%
			// 2009-09 : 15%
			// 2009-12 : 18%
			// 2010-01 : 18.5%
			// 2010-03 : 10.5%
			var check_now = new Date();
			var check_year = check_now.getYear() * 1000000;
			var check_month = (check_now.getMonth() + 1) * 10000;
			var check_date = check_now.getDate() * 100;
			var check_hour = check_now.getHours();
			var check_now_date = check_year + check_month + check_date + check_hour;
			//alert(check_now_date);
			//PST(한국과의 시차 -17시간) ,  PDT(한국과의 시차 -16시간)

			if (check_now_date >= 2010090100)
				fee = Math.round(d_fee * 10) / 100;
			else if (check_now_date >= 2010080100 && check_now_date < 2010090100)
				fee = Math.round(d_fee * 10.5) / 100;
			else if (check_now_date >= 2010070100 && check_now_date < 2010080100)
				fee = Math.round(d_fee * 11) / 100;
			else if (check_now_date >= 2010060100 && check_now_date < 2010070100)
				fee = Math.round(d_fee * 13) / 100;
			else if (check_now_date >= 2010050100 && check_now_date < 2010060100)
				fee = Math.round(d_fee * 11.5) / 100;
			else if (check_now_date >= 2010040100 && check_now_date < 2010050100)
				fee = Math.round(d_fee * 10) / 100;
			else if (check_now_date >= 2010030100 && check_now_date < 2010040100)
				fee = Math.round(d_fee * 10.5) / 100;
			else if (check_now_date >= 2010010100 && check_now_date < 2010030100)
				fee = Math.round(d_fee * 18.5) / 100;
			else if (check_now_date >= 2009120100 && check_now_date < 2010010100)
				fee = Math.round(d_fee * 18) / 100;
			else if (check_now_date >= 2009110100 && check_now_date < 2009120100)
				fee = Math.round(d_fee * 16) / 100;
			else if (check_now_date >= 2009100100 && check_now_date < 2009110100)
				fee = Math.round(d_fee * 17) / 100;
			else if (check_now_date >= 2009090100 && check_now_date < 2009100100)
				fee = Math.round(d_fee * 15) / 100;
			else if (check_now_date >= 2009040100 && check_now_date < 2009090100)
				fee = Math.round(d_fee * 8) / 100;
			else if (check_now_date >= 2009070100 && check_now_date < 2009040100)
				fee = Math.round(d_fee * 12.5) / 100;
			else
				fee = Math.round(d_fee * 12.5) / 100;

		break;
	}
	return fee;
}


// 국제배송료 - 보험료(야마토)
function calc_delivery_fee3(d_way , d_fee, goods_price)
{
	fee = 0.0;
	if(d_way == '') return 0;
	//2009-04-22 junko 요청으로 주석처리.
	//국제운송료 입력여부와 관계없이 보험료 계산.
	//if(d_fee == '' || d_fee <= 0) return 0;
	if(goods_price == '' || goods_price <= 0) return 0;
	switch(d_way) {
		case 'E' :
			//
		break;
		case 'Y' :
			// 상품가가 1000$ 이상인 경우 보험료 적용함.
			// ②＝ formula = (상품 대금 합계) ÷100 ×0.55  최저 보험료(Minimum charge)= $10.00
			if( goods_price >= 1000 ) {
				fee = Math.round(goods_price * 0.55) / 100;
				if(fee < 10) fee = 10;
			}
		break;
	}
	return fee;
}


function doResize()
{
	h = document.body.scrollHeight;
	w = document.body.scrollWidth;
	window.resizeTo(w,h);
}


/**
  * 페이지 내에 삽입되어있는 iframe 리사이즈
  * usage :
  * <iframe ... onload="iframeResize(this);"></iframe>
  */
function iframeResize(iframeElem)
{
	var iframeHeight = iframeElem.contentWindow.document.body.scrollHeight;
    iframeElem.height=iframeHeight+20;
}


// 회원 여부
function is_member()
{
	if(UserID == '') {
		//alert("회원만 이용가능합니다.");
		alert("会員様のみご利用可能です。");
		return false;
	}
	//alert(UserID);
	return true;
}


// 현재 날짜
function get_date()
{
	var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	var today=new Date();
	var todayy=today.getYear();
	if (todayy < 1000)
		todayy+=1900;
	var todaym=today.getMonth();
	var todayd=today.getDate();
	var todayh=today.getHours();
	var todaymin=today.getMinutes();
	var todaysec=today.getSeconds();
	var todaystring = montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;

	return todaystring;
}


function open_guide(url)
{ // open guide
	width = 670;
	height = 735;
	wleft = (screen.width-width)/2;
	//wtop = (screen.height-height)/2;
	wtop = 0;
	opt = 'width='+width+',height='+height+',left='+wleft+',top='+wtop+',toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes'
	guide_win = window.open(url,"GuideWin",opt);
	//window.focus = guide_win;
	guide_win.focus();
}


function open_bidform(url)
{ // open guide
	width = 620;
	height = 600;
	wleft = (screen.width-width)/2;
	//wtop = (screen.height-height)/2;
	wtop = 0;
	opt = 'width='+width+',height='+height+',left='+wleft+',top='+wtop+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'
	bid_win = window.open(url,"BidWin",opt);
	//window.focus = bid_win;
	bid_win.focus();
}