var $ = function() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {

        var element = arguments[i];

        if (typeof(element) == 'string') {
            element = document.getElementById(element);
        }

        if (arguments.length == 1) {
            return element;
        }
        elements.push(element);
    }
    return elements;
}

var $$ = function() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {

        var element = arguments[i];

        if (typeof(element) == 'string') {
            element = document.getElementByTagName(element);
        }

        if (arguments.length == 1) {
            return element;
        }
        elements.push(element);
    }
    return elements;
}

var $ce = function(tagName) {
    return document.createElement(tagName);
}

Array.prototype.remove = function(dx){
    if(isNaN(dx)||dx>this.length){
        return false;
    }
    for(var i=0,n=0;i<this.length;i++)
    {
        if(this[i]!=this[dx])
        {
            this[n++]=this[i]
        }
    }
    this.length-=1
}


var showTip = function(oEvent, sId, sWidth) {
    var oDiv = $(sId);

    oDiv.style.visibility = 'visible';
    oDiv.style.width = sWidth + "px";
    oDiv.style.left = oEvent.clientX + 5;
    oDiv.style.top  = oEvent.clientY + 5;
}

var hideTip = function(oEvent, sId) {
    var oDiv = $(sId);
    oDiv.style.visibility = 'hidden';
}

var fnRunterDel = function (msg) {
    if (confirm(msg)==true){
        return true;
    }else{
        return false;
    }
}

// 字符串替换
var fnReplaceStr = function(str) {
    str = str.replace(/</g,"&lt;");
    str = str.replace(/>/g,"&gt;");
    //str = str.replace(/'/g,"&apos;");
    //str = str.replace(/"/g,"&quot;");
    str = str.replace(/ /g,"&nbsp;");
    str = str.replace(/&/g,"&amp;");
    return str;
}
function getHtmlEntity( str )
{
      return  document.createElement('b').appendChild(document.createTextNode(str)).parentNode.innerHTML;
}