﻿
//设置背景颜色
var notifyset_backColor = "#f15a01";

//strFormat 的格式为 "abcd{v}efg，{v}表示输入的内容"
function showNotify(box, strFormat) {
    var str = box.value;
    str = str.replace(/-/g, "");
    var a = str.length;
    if (strFormat == "")
        strFormat = "400*-***-***";
    for (i = a; i < 10; i++) {
        str = str + "*";
    }

    var str2 = "400-" + str.substring(3, 7) +"-"+ str.substring(7, 10);
    
    strFormat = strFormat.replace("400*-***-***", str2);
    if (a == 1) {
        if (box.value != 4) {
            a = 0;
        }
    }
    if (a == 2) {
        if (box.value != 40) {
            a = 0;
        }
    }
    if (a == 3) {
        if (box.value != 400 && box.value!="400-") {
            a = 0;
        }
    }
    if (a == 0) {
        strFormat = "对不起，您输入的号码有误";
    }
    var boxX = getPageX(box);
    var boxY = getPageY(box);
    $("#notify_inputAlert").css("left", boxX + "px");
    $("#notify_inputAlert").css("top", boxY + 20 + "px");
    $("#notify_inputAlert").html(strFormat);
    $("#notify_inputAlert").show("50");
}

function hideNotify(box) {
    $("#notify_inputAlert").hide();
}


$(document).ready(function() {
$('<div id="notify_inputAlert" style="position:absolute; z-index:100;padding:5px;background-color:' + notifyset_backColor + ';"></div>').prependTo('body').hide();
});
