/**
 * @author Eddie
 */

function IArrayList() {
    
    /** @id ArrayList._mElements **/
    this._mElements = new Array();
}

/** @id ArrayList.add **/
IArrayList.prototype.add = function(pElement) {
    this._mElements.push(pElement);
}

/** @id ArrayList.remove **/
IArrayList.prototype.remove = function(pElement) {
    
    var _lRmE = null;
    
    var _lIdx = -1;
    
    if(typeof(pElement) == 'number') {
        _lIdx = pElement;
    }
    else {
        _lIdx = this._mElements.indexOf(pElement, 0);
    }
    
    if(_lIdx > -1 && _lIdx < this._mElements.length) {
        _lRmE = this._mElements.splice(_lIdx, 1);
    }
    return _lRmE;
}

/** @id ArrayList.get **/
IArrayList.prototype.get = function(pIndex) {
    return this._mElements[pIndex];
}

/** @id ArrayList.size **/
IArrayList.prototype.size = function() {
    return this._mElements.length;
}

/** @id ArrayList.isEmpty **/
IArrayList.prototype.isEmpty = function() {
    return (this._mElements.length > 0) ? true : false;
}

/** @id ArrayList.clear **/
IArrayList.prototype.clear = function() {
    this._mElements.length = 0;
}

var Util = new Object();

Util.url = {
	
	getArguments : function() {		

		var _la = new Object();
		_la.length = 0;
		
		if(location.search) {
            var _lq = location.search.substring(1);
            var _lqA = _lq.split('&');

            for(var i=0;i<_lqA.length;i++) {
                var _lpos = _lqA[i].indexOf('=');
 
                if(_lpos == 0) {
                    continue;
                }
                var _ln = _lqA[i].substring(0, _lpos).toLowerCase();
                var _lv = decodeURIComponent(_lqA[i].substring(_lpos+1));
                _la[_ln] = _lv;
                _la.length++;
            }
            
		}
		
		return _la;		
	},

	generateURL:function(pPath, pArgs) {
        
        var _lurl = "";
        
        if(pPath && pPath!=null) {
            _lurl = pPath;
        }
        
        if(pArgs) {
            var _lq = "";
            var _lc = 0;
            for(var _ln in pArgs) {
                if(_lc > 0) {
                   _lq+="&"; 
                }
                _lq+=(_ln+'='+encodeURIComponent(pArgs[_ln]));
                _lc++;
            }
            _lurl=_lurl+'?'+_lq;
        }
        
        return _lurl;
	}
};
	
function unfocus(pEl) {
	pEl.blur();
}

function cancelBubble(pEv) {
	if(!pEv) {
		return false;
	}
	
	if(pEv.stopPropagation) {
		pEv.stopPropagation();
	}
	else {
		pEv.cancelBubble = true;
	}
}

