DOMExtender = {
    
    initialize : function() { },
    
    AddTextArea : function(container, id, defaultValue, enterPressed)
    {
        this.AddInputByTagName(container, id, defaultValue, enterPressed, "textarea");
    },
    
    AddInput : function(container, id, defaultValue, enterPressed)
    {
        this.AddInputByTagName(container, id, defaultValue, enterPressed, "input");
    },
    
    AddInputByTagName : function(container, id, defaultValue, enterPressed, tagName)
    {
        var input = document.createElement(tagName);
        input.id = id;
        input.value = defaultValue;
        input.className = 'extendedInputNormal';
        $('#'+container).append(input);
        
        $('#'+id).bind("click", function(event) {
            var tmpInput = event.currentTarget;
            if(tmpInput.value == defaultValue)
            {
                tmpInput.val("");
                tmpInput.className = 'extendedInputActual';
            }
        });
        
        $('#'+id).bind("focus", function(event) {
            var tmpInput = event.currentTarget;
            if(tmpInput.value == defaultValue)
            {
                tmpInput.value = "";
                tmpInput.className = 'extendedInputActual';
            }
        });
        
        $('#'+id).bind("keypress", function(event) {
            if(event.keyCode == 13 && enterPressed != null ) { enterPressed(event); }
        });
        
        $('#'+id).bind("blur", function(event) {
            var tmpInput = event.currentTarget;
            if(tmpInput.value == "")
            {
                tmpInput.className = 'extendedInputNormal';
                tmpInput.value = defaultValue;
            }
        });
        
    }
    
};
