﻿String.prototype.trim = function()
{
    return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
String.prototype.endsWith = function(str)
{
    return (this.match(str + "$") == str)
}
String.prototype.startsWith = function(str)
{
    return (this.match("^" + str) == str)
}


function getStyleObject(objectId) {
    // checkW3C DOM, then MSIE 4, then NN 4.
    if(document.getElementById && document.getElementById(objectId))
        return document.getElementById(objectId).style;
    else if (document.all && document.all(objectId))
        return document.all(objectId).style;
    else if (document.layers && document.layers[objectId])
        return document.layers[objectId];
    else
        return false;
}
function changeVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId);
    if (styleObject)
        styleObject.visibility = newVisibility;
}
function changeDisplay(objectId, newDisplay)
{
    var styleObject = getStyleObject(objectId);
    if (styleObject)
        styleObject.display = newDisplay;
}