String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }

// block client errors
window.onerror = function () { return false };
//---------------------------------------------------------------------------------------
function GEBI(idObj)
{
    var oObj = null;

    // get obj by id / name ( in IE it does not matter ) 
    oObj = document.getElementById(idObj);

    // code for other browsers
    if (!oObj)
    {
        if (bIsFireFox)
        {
            if (document.all)
            {
                oObj = document.all(idObj);
            }
        }
        else
        {
            oObj = document.all(idObj);
        }
    }

    return oObj;
}
//---------------------------------------------------------------------------------------
function IncludeJS( strSrc )
 {
    try
    { 
        var script = document.createElement("script"); 
        script.type="text/javascript"; 
        script.src = strSrc;
        document.getElementsByTagName('head').item(0).appendChild(script);
    }
    catch ( e ) {}
 }  
//---------------------------------------------------------------------------------------
function EncodeParams ( strParams )
{
    var strRet = "";
    try
    { 
        if ( strParams.length > 0  )
        {
            var KeyValArray = strParams.split("&");
            
            for ( i = 0; i < KeyValArray.length; i++ )
            {
                var oElm = KeyValArray[i];
                
                if ( oElm )
                {
                    var strKey = oElm.split("=")[0];
                    var strVal = oElm.split("=")[1];
                
                    var strEncodedVal = encodeURIComponent(strVal);

                    strRet += strKey + "=" + strEncodedVal;
                    
                    if ( i < KeyValArray.length - 1 )  strRet += "&";
                }
            }
        }     
    }
    catch ( e ) {}
    
    return strRet;
}
//---------------------------------------------------------------------------------------
