bnbweb/js/user.js
2022-11-14 23:49:28 +08:00

1192 lines
26 KiB
JavaScript
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* $Id : user.js 4865 2007-01-31 14:04:10Z paulgao $ */
/* *
* 修改会员信息
*/
function userEdit()
{
var frm = document.forms['formEdit'];
// var email = frm.elements['email'].value;
var msg = '';
var reg = null;
var passwd_answer = frm.elements['passwd_answer'] ? Utils.trim(frm.elements['passwd_answer'].value) : '';
var sel_question = frm.elements['sel_question'] ? Utils.trim(frm.elements['sel_question'].value) : '';
// if (email.length == 0)
// {
// msg += email_empty + '<br/>';
// }
// else
// {
// if ( ! (Utils.isEmail(email)))
// {
// msg += email_error + '<br/>';
// }
// }
if (passwd_answer.length > 0 && sel_question == 0 || document.getElementById('passwd_quesetion') && passwd_answer.length == 0)
{
msg += no_select_question + '<br/>';
}
for (i = 7; i < frm.elements.length - 2; i++) // 从第七项开始循环检查是否为必填项
{
needinput = document.getElementById(frm.elements[i].name + 'i') ? document.getElementById(frm.elements[i].name + 'i') : '';
if (needinput != '' && frm.elements[i].value.length == 0)
{
msg += '- ' + needinput.innerHTML + msg_blank + '<br/>';
}
}
if (msg.length > 0)
{
alert(msg);
return false;
}
else
{
return true;
}
}
/* 会员修改密码 */
function editPassword()
{
var frm = document.forms['formPassword'];
var old_password = frm.elements['old_password'].value;
var new_password = frm.elements['new_password'].value;
var confirm_password = frm.elements['comfirm_password'].value;
var msg = '';
var reg = null;
if (old_password.length == 0)
{
msg += old_password_empty + '<br/>';
}
if (new_password.length == 0)
{
msg += new_password_empty + '<br/>';
}
if (confirm_password.length == 0)
{
msg += confirm_password_empty + '<br/>';
}
if (new_password.length > 0 && confirm_password.length > 0)
{
if (new_password != confirm_password)
{
msg += both_password_error + '<br/>';
}
}
if (msg.length > 0)
{
swal({
title: "系統訊息",
html: msg,
type: "error",
confirmButtonText:"確定"/*改這裡*/
});
return false;
}
else
{
return true;
}
}
/* 会员绑定手机 */
function bindMobile()
{
var frm = document.forms['formBindmobile'];
var mobile = frm.elements['mobile'].value;
var verifycode = frm.elements['verifycode'].value;
var msg = '';
var reg = null;
if (mobile.length == 0)
{
msg += '手机号不能为空!<br/>';
}
if (mobile.length != 11)
{
msg += '手机号必须为11位<br/>';
}
if (verifycode.length == 0)
{
msg += '验证码不能为空!<br/>';
}
if (verifycode.length != 6)
{
msg += '验证码必须为6位<br/>';
}
if (msg.length > 0)
{
alert(msg);
return false;
}
else
{
return true;
}
}
/* *
* 对会员的留言输入作处理
*/
function submitMsg()
{
var frm = document.forms['formMsg'];
var msg_title = frm.elements['msg_title'].value;
var msg_content = frm.elements['msg_content'].value;
var msg = '';
if (msg_title.length == 0)
{
msg += msg_title_empty + '<br/>';
}
if (msg_content.length == 0)
{
msg += msg_content_empty + '<br/>'
}
if (msg_title.length > 200)
{
msg += msg_title_limit + '<br/>';
}
if (msg.length > 0)
{
alert(msg);
return false;
}
else
{
return true;
}
}
/* *
* 会员找回密码时,对输入作处理
*/
function submitPwdInfo()
{
var frm = document.forms['getPassword'];
var user_name = frm.elements['user_name'].value;
var email = frm.elements['email'].value;
var errorMsg = '';
if (user_name.length == 0)
{
errorMsg += user_name_empty + '<br/>';
}
if (email.length == 0)
{
errorMsg += email_address_empty + '<br/>';
}
else
{
if ( ! (Utils.isEmail(email)))
{
errorMsg += email_address_error + '<br/>';
}
}
if (errorMsg.length > 0)
{
alert(errorMsg);
return false;
}
return true;
}
//互亿无线代码
/* *
* 会员找回密码时,对输入作处理
*/
function submitPwdMobileInfo()
{
var frm = document.forms['getPasswordByMobile'];
var user_name = frm.elements['user_name'].value;
var mobile = frm.elements['mobile'].value;
var errorMsg = '';
if (user_name.length == 0)
{
errorMsg += user_name_empty + '<br/>';
}
if (mobile.length == 0)
{
errorMsg += mobile_address_empty + '<br/>';
}
else
{
if ( ! (Utils.isMobile(mobile)))
{
errorMsg += mobile_address_error + '<br/>';
}
}
if (errorMsg.length > 0)
{
alert(errorMsg);
return false;
}
return true;
}
//互亿无线代码
/* *
* 会员找回密码时,对输入作处理
*/
function submitPwd()
{
var frm = document.forms['getPassword2'];
var password = frm.elements['new_password'].value;
var confirm_password = frm.elements['confirm_password'].value;
var errorMsg = '';
if (password.length == 0)
{
errorMsg += new_password_empty + '<br/>';
}
if (confirm_password.length == 0)
{
errorMsg += confirm_password_empty + '<br/>';
}
if (confirm_password != password)
{
errorMsg += both_password_error + '<br/>';
}
if (errorMsg.length > 0)
{
alert(errorMsg);
return false;
}
else
{
return true;
}
}
/* *
* 处理会员提交的缺货登记
*/
function addBooking()
{
var frm = document.forms['formBooking'];
var goods_id = frm.elements['id'].value;
var rec_id = frm.elements['rec_id'].value;
var number = frm.elements['number'].value;
var desc = frm.elements['desc'].value;
var linkman = frm.elements['linkman'].value;
var email = frm.elements['email'].value;
var tel = frm.elements['tel'].value;
var msg = "";
if (number.length == 0)
{
msg += booking_amount_empty + '<br/>';
}
else
{
var reg = /^[0-9]+/;
if ( ! reg.test(number))
{
msg += booking_amount_error + '<br/>';
}
}
if (desc.length == 0)
{
msg += describe_empty + '<br/>';
}
if (linkman.length == 0)
{
msg += contact_username_empty + '<br/>';
}
if (email.length == 0)
{
msg += email_empty + '<br/>';
}
else
{
if ( ! (Utils.isEmail(email)))
{
msg += email_error + '<br/>';
}
}
if (tel.length == 0)
{
msg += contact_phone_empty + '<br/>';
}
if (msg.length > 0)
{
alert(msg);
return false;
}
return true;
}
/* *
* 会员登录
*/
function userLogin()
{
var frm = document.forms['formLogin'];
var username = frm.elements['username'].value;
var password = frm.elements['password'].value;
var captcha = frm.elements['captcha'] ? Utils.trim(frm.elements['captcha'].value) : '';
var msg = '';
if (username.length == 0)
{
msg += username_empty + '<br/>';
}
if (password.length == 0)
{
msg += password_empty + '<br/>';
}
if (msg.length > 0)
{
swal({
title: '登入錯誤',
type: 'error',
html: msg + '<a href="user.php?act=mpassword_name"><font color="red">忘記密碼?</font></a>'
});
return false;
}
else
{
$.ajax({
url:"user.php?act=signin",
data: 'username=' + username + '&password=' + password + '&captcha=' + captcha,
type : "POST",
dataType: "json",
beforeSend:function(){
//$('#loading_div').show();
},
success:function(msg){
if(msg.error =="0"){
window.location.href="index.php";
}else if(msg.error=="1")
{
$('#captcha').val('');
$('#captcha').focus();
swal({
title: '登入錯誤',
type: 'error',
html: msg.content + '<a href="user.php?act=mpassword_name"><font color="red">忘記密碼?</font></a>'
});
//$('#error_msg').show();
//$('#error_msg').html('Please Login again,<br/>沒有此用戶或密碼不正確');
}else if(msg.error=="2")
{
$('#username').val('');
$('#password').val('');
$('#username').focus();
swal({
title: '登入錯誤',
type: 'error',
html: msg.content + '<a href="user.php?act=mpassword_name"><font color="red">忘記密碼?</font></a>'
});
}else if(msg.error=="3")
{
$('#username').val('');
$('#password').val('');
$('#username').focus();
swal({
title: '登入錯誤',
type: 'error',
html: msg.content
});
}
},
error:function(xhr){
alert('Ajax request 發生錯誤');
},
complete:function(){
$('#loading_div').hide();
//$('#user_login').hide();
//complete請求完成實執行的函式不管是success或是error
}
});
return true;
}
}
function chkstr(str)
{
for (var i = 0; i < str.length; i++)
{
if (str.charCodeAt(i) < 127 && !str.substr(i,1).match(/^\w+$/ig))
{
return false;
}
}
return true;
}
function check_password( password )
{
if ( password.length < 6 )
{
document.getElementById('password_notice').innerHTML = password_shorter;
}
else if (!(password.match(/([0-9])+/) && (password.match(/([a-z])+/) || password.match(/([A-Z])+/))))
{
document.getElementById('password_notice').innerHTML = password_isSimple;
}
else
{
document.getElementById('password_notice').innerHTML = msg_can_rg;
}
}
function check_conform_password( conform_password )
{
password = document.getElementById('password1').value;
if ( conform_password.length < 6 )
{
document.getElementById('conform_password_notice').innerHTML = password_shorter;
return false;
}
if ( conform_password != password )
{
document.getElementById('conform_password_notice').innerHTML = confirm_password_invalid;
}
else
{
document.getElementById('conform_password_notice').innerHTML = msg_can_rg;
}
}
function is_registered( username )
{
var submit_disabled = false;
var unlen = username.replace(/[^\x00-\xff]/g, "**").length;
if ( username == '' )
{
document.getElementById('username_notice').innerHTML = msg_un_blank;
var submit_disabled = true;
}
if ( !chkstr( username ) )
{
document.getElementById('username_notice').innerHTML = msg_un_format;
var submit_disabled = true;
}
if ( unlen < 6 )
{
document.getElementById('username_notice').innerHTML = username_shorter;
var submit_disabled = true;
}
if ( unlen > 10 )
{
document.getElementById('username_notice').innerHTML = msg_un_length;
var submit_disabled = true;
}
var regex1 = /^[a-zA-Z0-9]*$/;
var regex2 = /^[0-9]*$/;
if ( submit_disabled )
{
document.forms['formUser'].elements['Submit'].disabled = 'disabled';
return false;
}
Ajax.call( 'user.php?act=is_registered', 'username=' + username, registed_callback , 'GET', 'TEXT', true, true );
}
function registed_callback(result)
{
if ( result == "true" )
{
document.getElementById('username_notice').innerHTML = msg_can_rg;
document.forms['formUser'].elements['Submit'].disabled = '';
}
else
{
document.getElementById('username_notice').innerHTML = msg_un_registered;
document.forms['formUser'].elements['Submit'].disabled = 'disabled';
}
}
function checkMobile(mobile)
{
var submit_disabled = false;
if (mobile == '')
{
document.getElementById('mobile_notice').innerHTML = msg_mobile_blank;
submit_disabled = true;
}
else if (!Utils.isMobile(mobile))
{
document.getElementById('mobile_notice').innerHTML = msg_mobile_format;
submit_disabled = true;
}
if( submit_disabled )
{
document.forms['formUser'].elements['Submit'].disabled = 'disabled';
return false;
}
Ajax.call( 'user.php?act=mobile_chk', 'mobile=' + mobile, check_mobile_callback , 'GET', 'TEXT', true, true );
}
function check_mobile_callback(result)
{
if ( result == 'ok' )
{
document.getElementById('mobile_notice').innerHTML = msg_can_rg;
document.forms['formUser'].elements['Submit'].disabled = '';
}
else
{
document.getElementById('mobile_notice').innerHTML = msg_mobile_registered;
document.forms['formUser'].elements['Submit'].disabled = 'disabled';
}
}
/* *
*會員註冊
*/
function register(type)
{
var frm = document.forms['formUser'];
// var username = Utils.trim(frm.elements['username'].value);
// var email = frm.elements['email'].value;
var password = Utils.trim(frm.elements['password'].value);
var confirm_password = Utils.trim(frm.elements['confirm_password'].value);
var checked_agreement = frm.elements['agreement'].checked;
// var is_captcha = frm.elements['captcha']? '1':'0';
// var captcha = frm.elements['captcha'] ? Utils.trim(frm.elements['captcha'].value) : '';
if(type==0){
var is_sms_vc = frm.elements['sms_verifycode']? '1':'0';
var sms_verifycode = frm.elements['sms_verifycode'] ? Utils.trim(frm.elements['sms_verifycode'].value) : '';
}
var msn = frm.elements['extend_field1'] ? Utils.trim(frm.elements['extend_field1'].value) : '';
var qq = frm.elements['extend_field2'] ? Utils.trim(frm.elements['extend_field2'].value) : '';
var home_phone = frm.elements['extend_field4'] ? Utils.trim(frm.elements['extend_field4'].value) : '';
var office_phone = frm.elements['extend_field3'] ? Utils.trim(frm.elements['extend_field3'].value) : '';
var mobile_phone = frm.elements['extend_field5'] ? Utils.trim(frm.elements['extend_field5'].value) : '';
var passwd_answer = frm.elements['passwd_answer'] ? Utils.trim(frm.elements['passwd_answer'].value) : '';
var sel_question = frm.elements['sel_question'] ? Utils.trim(frm.elements['sel_question'].value) : '';
var msg = "";
// 检查输入
var msg = '';
var regex1 = /^[a-zA-Z0-9]*$/;
var regex2 = /^[0-9]*$/;
if (password.length == 0)
{
msg += password_empty + '<br/>';
}
else if (password.length < 6)
{
msg += password_shorter + '<br/>';
}
if (!(regex1.test(password) && !regex2.test(password)))
{
msg += password_invalid + '<br/>';
}
if (/ /.test(password) == true)
{
msg += passwd_balnk + '<br/>';
}
if (confirm_password != password )
{
msg += confirm_password_invalid + '<br/>';
}
if(type==0){
if(is_sms_vc){
if (sms_verifycode.length == 0 )
{
msg += sms_verifycode_invalid + '<br/>';
}
}
}
if(checked_agreement != true)
{
msg += agreement + '<br/>';
}
// if (msn.length > 0 && (!Utils.isEmail(msn)))
// {
// msg += msn_invalid + '<br/>';
// }
if (qq.length > 0 && (!Utils.isNumber(qq)))
{
msg += qq_invalid + '<br/>';
}
if (office_phone.length>0)
{
var reg = /^[\d|\-|\s]+$/;
if (!reg.test(office_phone))
{
msg += office_phone_invalid + '<br/>';
}
}
if (home_phone.length>0)
{
var reg = /^[\d|\-|\s]+$/;
if (!reg.test(home_phone))
{
msg += home_phone_invalid + '<br/>';
}
}
if (mobile_phone.length>0)
{
var reg = /^[\d|\-|\s]+$/;
if (!reg.test(mobile_phone))
{
msg += mobile_phone_invalid + '<br/>';
}
}
if (passwd_answer.length > 0 && sel_question == 0 || document.getElementById('passwd_quesetion') && passwd_answer.length == 0)
{
msg += no_select_question + '<br/>';
}
for (i = 4; i < frm.elements.length - 4; i++) // 从第五项开始循环检查是否为必填项
{
needinput = document.getElementById(frm.elements[i].name + 'i') ? document.getElementById(frm.elements[i].name + 'i') : '';
if (needinput != '' && frm.elements[i].value.length == 0)
{
msg += '- ' + needinput.innerHTML + msg_blank + '<br/>';
}
}
if (msg.length > 0)
{
swal({
title: '填寫錯誤',
type: 'error',
html: msg
});
return false;
}
else
{
return true;
}
}
function validated_id(){
var frm = document.forms['formForm'];
var account_no = Utils.trim(frm.elements['account_no'].value);
var account_name = Utils.trim(frm.elements['account_name'].value);
var branch = Utils.trim(frm.elements['branch'].value);
var bank_code = frm.elements['bank_code'].value;
var user_idno = frm.elements['user_idno'].value;
var msg = '';
if (bank_code==0)
{
msg += bankcode_empty + '<br/>';
}
if (account_no.length == 0)
{
msg += accountno_empty + '<br/>';
}
if (account_name.length == 0)
{
msg += accountname_empty + '<br/>';
}
if (branch.length == 0)
{
msg += branch_empty + '<br/>';
}
if (user_idno.length == 0)
{
msg += user_idno_empty + '<br/>';
}
if (!Utils.isNumber(account_no))
{
msg += accountno_invalid + '<br/>';
}
if (msg.length > 0)
{
swal({
title: '填寫錯誤',
type: 'error',
html: msg
});
return false;
}
else
{
return true;
}
}
/* *
* 用户中心订单保存地址信息
*/
function saveOrderAddress(id)
{
var frm = document.forms['formAddress'];
var consignee = frm.elements['consignee'].value;
var email = frm.elements['email'].value;
var address = frm.elements['address'].value;
var zipcode = frm.elements['zipcode'].value;
var tel = frm.elements['tel'].value;
var mobile = frm.elements['mobile'].value;
var sign_building = frm.elements['sign_building'].value;
var best_time = frm.elements['best_time'].value;
if (id == 0)
{
alert(current_ss_not_unshipped);
return false;
}
var msg = '';
if (address.length == 0)
{
msg += address_name_not_null + "<br/>";
}
if (consignee.length == 0)
{
msg += consignee_not_null + "<br/>";
}
if (msg.length > 0)
{
alert(msg);
return false;
}
else
{
return true;
}
}
/* *
* 会员余额申请
*/
function submitSurplus()
{
var frm = document.forms['formSurplus'];
var surplus_type = frm.elements['surplus_type'].value;
var surplus_amount = frm.elements['amount'].value;
// var process_notic = frm.elements['user_note'].value;
var payment_id = frm.elements['payment_id'].value;
var msg = '';
if (surplus_amount.length == 0 )
{
msg += surplus_amount_empty + "<br/>";
}
else
{
var reg = /^[\.0-9]+/;
if ( ! reg.test(surplus_amount))
{
msg += surplus_amount_error + '<br/>';
}
}
//if (process_notic.length == 0)
//{
// msg += process_desc + "<br/>";
//}
if (msg.length > 0)
{
swal({
title: "系統訊息",
html: msg,
type: "error",
confirmButtonText:"確定"/*改這裡*/
});
return false;
}
if (surplus_type == 0)
{
for (i = 0; i < frm.elements.length ; i ++)
{
if (frm.elements[i].name=="payment_id" && frm.elements[i].checked)
{
payment_id = frm.elements[i].value;
break;
}
}
if (payment_id == 0)
{
alert(payment_empty);
return false;
}
}
rtn=Ajax.call( 'user.php?act=chk_payment', 'amount=' + surplus_amount + '&payment_id=' + payment_id, chkpayment_callback , 'GET', 'TEXT', false, true );
if(rtn){
return true;
}else{
return false;
}
}
function chkpayment_callback(result)
{
if ( result == true )
{
// document.forms['formSurplus'].submit();
return true;
}
else
{
swal({
title: "系統訊息",
html: "金額大於或小於限定金額",
type: "error",
confirmButtonText:"確定"/*改這裡*/
});
return false;
}
}
/* *
* 会员余额申请
*/
function submitWithdraw()
{
var frm = document.forms['formWithdraw'];
var amount = frm.elements['amount'].value;
var payment_id = 0;
var msg = '';
if (amount.length == 0 )
{
msg += surplus_amount_empty + "<br/>";
}
else
{
var reg = /^[\.0-9]+/;
if ( ! reg.test(amount))
{
msg += surplus_amount_error + '<br/>';
}
}
if (msg.length > 0)
{
swal({
title: "系統訊息",
html: msg,
type: "error",
confirmButtonText:"確定"/*改這裡*/
});
return false;
}
return true;
}
/* *
* 会员余额申请
*/
function submitTransfer()
{
var frm = document.forms['formTransfer'];
var surplus_type = frm.elements['surplus_type'].value;
var surplus_amount = frm.elements['amount'].value;
var tran_out = frm.elements['tran_out'].value;
var tran_in = frm.elements['tran_in'].value;
var msg = '';
if (surplus_amount.length == 0 )
{
msg += surplus_amount_empty + "<br/>";
}
else
{
var reg = /^[\.0-9]+/;
if ( ! reg.test(surplus_amount))
{
msg += surplus_amount_error + '<br/>';
}
}
if (tran_out == tran_in)
{
msg += tran_error + '<br/>';
}
if (msg.length > 0)
{
alert(msg);
return false;
}
return true;
}
/* *
* 处理用户添加一个红包
*/
function addBonus()
{
var frm = document.forms['addBouns'];
var bonus_sn = frm.elements['bonus_sn'].value;
if (bonus_sn.length == 0)
{
alert(bonus_sn_empty);
return false;
}
else
{
var reg = /^[0-9]{10}$/;
if ( ! reg.test(bonus_sn))
{
alert(bonus_sn_error);
return false;
}
}
return true;
}
/* *
* 合并订单检查
*/
function mergeOrder()
{
if (!confirm(confirm_merge))
{
return false;
}
var frm = document.forms['formOrder'];
var from_order = frm.elements['from_order'].value;
var to_order = frm.elements['to_order'].value;
var msg = '';
if (from_order == 0)
{
msg += from_order_empty + '<br/>';
}
if (to_order == 0)
{
msg += to_order_empty + '<br/>';
}
else if (to_order == from_order)
{
msg += order_same + '<br/>';
}
if (msg.length > 0)
{
alert(msg);
return false;
}
else
{
return true;
}
}
/* *
* 订单中的商品返回购物车
* @param int orderId 订单号
*/
function returnToCart(orderId)
{
Ajax.call('user.php?act=return_to_cart', 'order_id=' + orderId, returnToCartResponse, 'POST', 'JSON');
}
function returnToCartResponse(result)
{
alert(result.message);
}
/* *
* 检测密码强度
* @param string pwd 密码
*/
function checkIntensity(pwd)
{
var Mcolor = "#FFF",Lcolor = "#FFF",Hcolor = "#FFF";
var m=0;
var Modes = 0;
for (i=0; i<pwd.length; i++)
{
var charType = 0;
var t = pwd.charCodeAt(i);
if (t>=48 && t <=57)
{
charType = 1;
}
else if (t>=65 && t <=90)
{
charType = 2;
}
else if (t>=97 && t <=122)
charType = 4;
else
charType = 4;
Modes |= charType;
}
for (i=0;i<4;i++)
{
if (Modes & 1) m++;
Modes>>>=1;
}
if (pwd.length<=4)
{
m = 1;
}
switch(m)
{
case 1 :
Lcolor = "2px solid red";
Mcolor = Hcolor = "2px solid #DADADA";
break;
case 2 :
Mcolor = "2px solid #f90";
Lcolor = Hcolor = "2px solid #DADADA";
break;
case 3 :
Hcolor = "2px solid #3c0";
Lcolor = Mcolor = "2px solid #DADADA";
break;
case 4 :
Hcolor = "2px solid #3c0";
Lcolor = Mcolor = "2px solid #DADADA";
break;
default :
Hcolor = Mcolor = Lcolor = "";
break;
}
if (document.getElementById("pwd_lower"))
{
document.getElementById("pwd_lower").style.borderBottom = Lcolor;
document.getElementById("pwd_middle").style.borderBottom = Mcolor;
document.getElementById("pwd_high").style.borderBottom = Hcolor;
}
}
function changeType(obj)
{
if (obj.getAttribute("min") && document.getElementById("ECS_AMOUNT"))
{
document.getElementById("ECS_AMOUNT").disabled = false;
document.getElementById("ECS_AMOUNT").value = obj.getAttribute("min");
if (document.getElementById("ECS_NOTICE") && obj.getAttribute("to") && obj.getAttribute('fee'))
{
var fee = parseInt(obj.getAttribute("fee"));
var to = parseInt(obj.getAttribute("to"));
if (fee < 0)
{
to = to + fee * 2;
}
document.getElementById("ECS_NOTICE").innerHTML = notice_result + to;
}
}
}
function calResult()
{
var amount = document.getElementById("ECS_AMOUNT").value;
var notice = document.getElementById("ECS_NOTICE");
reg = /^\d+$/;
if (!reg.test(amount))
{
notice.innerHTML = notice_not_int;
return;
}
amount = parseInt(amount);
var frm = document.forms['transform'];
for(i=0; i < frm.elements['type'].length; i++)
{
if (frm.elements['type'][i].checked)
{
var min = parseInt(frm.elements['type'][i].getAttribute("min"));
var to = parseInt(frm.elements['type'][i].getAttribute("to"));
var fee = parseInt(frm.elements['type'][i].getAttribute("fee"));
var result = 0;
if (amount < min)
{
notice.innerHTML = notice_overflow + min;
return;
}
if (fee > 0)
{
result = (amount - fee) * to / (min -fee);
}
else
{
//result = (amount + fee* min /(to+fee)) * (to + fee) / min ;
result = amount * (to + fee) / min + fee;
}
notice.innerHTML = notice_result + parseInt(result + 0.5);
}
}
}