﻿String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}

String.prototype.ltrim = function() {
return this.replace(/^\s+/, '');
}

String.prototype.rtrim = function() {
return this.replace(/\s+$/, '');
}

function simulaClick(element, eventName) {
    if(document.all){
        document.getElementById(element).click();
    }
    else{
        var oEvent = document.createEvent("MouseEvents");
        oEvent.initMouseEvent(eventName, true, true, document.defaultView, 
        1, 0, 0, 0, 0, false, false, false, false, 0, document.getElementById(element));
        document.getElementById(element).dispatchEvent(oEvent);
    }
}