function calc_teltel(){
var text = $("#tel_text").val();
text = fascii2ascii(text);
text = text.replace(/\s+/g, "");
text = text.replace(/(\w)(ー+)/g, "$1-");
text = text.replace(/[()−-]+/g, "-");
text = text.replace(/^-/g, "");
if(text.indexOf("@")>0) text = text.toLowerCase();
$("#tel_text").val(text);
return false;
}
var fascii2ascii = (function(){
var cclass
= '['+String.fromCharCode(0xff01)+'-'+String.fromCharCode(0xff5e)+']';
var re_fullwidth = new RegExp(cclass, 'g');
var substitution = function(m){
return String.fromCharCode(m.charCodeAt(0) - 0xfee0);
};
return function(s){ return s.replace(re_fullwidth, substitution) };
})();