Your IP : 216.73.216.34


Current Path : /home/zqegovsj/www/us3web.haibo.com.cn/biguo/image/js/
Upload File :
Current File : /home/zqegovsj/www/us3web.haibo.com.cn/biguo/image/js/descCheck.js

var specialChars = ["?", "±", "×", "8216", "?", "8212", "8804", "8805", "§", "969", "945", "946", "947", "948", "951", "952", "955", "956", "957", "958", "960", "963", "964", "966", "967", "931", "934", "937", "8712", "8240", "÷", "8800", "961", "8744", "8743", "8721", "8734", "8801", "8730", "·", "916", "?", "?", "?", "?", "?", "?", "?", "?", "C?", "F°", "?", "?", "8364", "?", "8482", "8544", "8545", "8546", "8776", "8750", "710", "172", "915", "953", "954", "968", "8747", "8745", "8746", "916"];
var win = null;
function check(object, input_value){
    if (!(checkChinese(input_value))) {
        alert('Sorry, the information you filled is not in English. Please input in English instead');
        object.focus();
    }
}

function checkDesc(id){
    var desc = document.getElementById(id);
    var value = desc.value;
    if (!checkSpecialChinese(value)) {
        open_window_specialChar(value);
        return false;
    }
    else {
        return true;
    }
}

function checkSpecialChinese(myint){
    var str = myint;
    var isChinese = true;
    for (i = 0; i < str.length; i++) {
        c = str.charCodeAt(i);
        if (c == 25 || (c > 128 && !isOkSpecialChar(c))) {
            isChinese = false;
            break;
        }
    }
    if (!isChinese) {
        return (false);
    }
    return (true);
}

function isOkSpecialChar(ch){
    for (j = 0; j < specialChars.length; j++) 
        if (ch == specialChars[j]) {
            return true;
        }
    return false;
}

function isOkChar(ch){
    for (j = 0; j < specialChars.length; j++) 
        if (ch == checkOk[j]) {
            return true;
        }
    return false;
}

function open_window_specialChar(str){
    str = transHTML(str);
    var new_html = '<h6><a  href="javascript:hidePop4Error(\'pop\')" title="close">&nbsp;</a>Error</h6>' +
    '<div class="cent" style="padding: 0pt 20px 20px;">' +
    '<p class="red">Sorry, you input non-English characters (Marked in red below). Please modify them into English.</p> ' +
    '<p ><div class="errorDiv" ></div></p></div>';
    var new_body = '';
    for (i = 0; i < str.length; i++) {
        ch = str.charCodeAt(i);
        errChar = str.charAt(i);
        if (ch == 25 || (ch > 128 && !isOkSpecialChar(ch))) {
            if (ch == 12288) {
                new_body += '<font color="#CC0000"><b>&amp;nbsp;</b></font>';
            }
            else {
                new_body += '<font color="#CC0000" size="+1"><b>' + errChar +
                '</b></font>';
            }
        }
        else {
            new_body += errChar;
        }
    }
    jQuery('#pop').html(new_html);
    jQuery('#errorDiv').html(new_body);
    showPopMenu('pop');
}

function hidePop4Error(obj){
    var arr = document.getElementsByTagName("select");
    if (arr && arr.length > 0) {
        for (var i = 0; i < arr.length; i++) {
            arr[i].style.visibility = "inherit";
        }
    }
    if (interval) 
        clearInterval(interval);
    unshowAlpha();
    var objshow = document.getElementById(obj);
    if (!objshow) {
        return;
    }
    var objshowClass = objshow.className;
    if (objshowClass.indexOf("expanded") >= 0) {
        objshow.className = objshowClass.replace("expanded", "collapsed");
    }
    jQuery('#pop').html("");
}

function transHTML(str){
    var regexp1 = /\r\n/gi;
    var regexp2 = /\n/gi;
    var regexp3 = /</gi;
    var regexp4 = />/gi;
    str = str.replace(regexp3, "&lt;");
    str = str.replace(regexp4, "&gt;");
    str = str.replace(regexp1, "<br>");
    str = str.replace(regexp2, "<br>");
    return str;
}

function checkForm(id){
    if (checkDesc(id)) {
        return jQuery.formValidator.PageIsValid('1');
    }
    else {
        return false;
    }
}