

var __aspxLabelValueSuffix = "_V";
ASPxClientStaticEdit = _aspxCreateClass(ASPxClientEditBase, { 
    constructor: function(name) {
        this.constructor.prototype.constructor.call(this, name);
        this.Click = new ASPxClientEvent();
    },

    OnClick: function(htmlEvent) {
        this.RaiseClick(this.GetMainElement(), htmlEvent);
    },
    RaiseClick: function(htmlElement, htmlEvent){
        if(!this.Click.IsEmpty()){
            var args = new ASPxClientEditClickEventArgs(htmlElement, htmlEvent);
            this.Click.FireEvent(this, args);
        }
    },
    
    ChangeEnabledAttributes: function(enabled){
        this.ChangeMainElementAttributes(this.GetMainElement(), _aspxChangeAttributesMethod(enabled));
    },
    ChangeEnabledStateItems: function(enabled){
        aspxGetStateController().SetElementEnabled(this.GetMainElement(), enabled);
    },
	ChangeMainElementAttributes: function(element, method){
        method(element, "onclick");
	}
});
ASPxClientEditClickEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
    constructor: function(htmlElement, htmlEvent){
        this.constructor.prototype.constructor.call(this);
        this.htmlElement = htmlElement;
        this.htmlEvent = htmlEvent;
    }
});
ASPxClientHyperLink = _aspxCreateClass(ASPxClientStaticEdit, {
    constructor: function(name) {
        this.constructor.prototype.constructor.call(this, name);
    },
    GetNavigateUrl: function(){
        var element = this.GetMainElement();
        if(_aspxIsExistsElement(element))
            return element.href;
        return "";
    },
    SetNavigateUrl: function(url){
        var element = this.GetMainElement();
        if(_aspxIsExistsElement(element))
            element.href = url;
    },
    GetText: function(){
        return this.GetValue();
    },
    SetText: function(value){
        this.SetValue(value);
    },
    
	ChangeMainElementAttributes: function(element, method){
	    ASPxClientStaticEdit.prototype.ChangeMainElementAttributes.call(this, element, method);
        method(element, "href");
	}
});
ASPxClientImage = _aspxCreateClass(ASPxClientStaticEdit, {
    constructor: function(name) {
        this.constructor.prototype.constructor.call(this, name);
        
        this.isEmpty = false;
    },
    GetValue: function() {
        if(this.isEmpty)
            return "";
        var element = this.GetMainElement();
        if(_aspxIsExistsElement(element))
            return element.src;
        return "";
    },
    SetValue: function(value) {
        if(value == null)
            value = "";
        this.isEmpty = value == "";            
        var element = this.GetMainElement();
        if(_aspxIsExistsElement(element))
            element.src = value; // TODO Account png url posibility
    },
    GetImageUrl: function(url){
        return this.GetValue();
    },
    SetImageUrl: function(url){
        this.SetValue(url);
    },
    GetWidth: function(){
        return this.GetSize(true);
    },
    GetHeight: function(){
        return this.GetSize(false);
    },
    SetSize: function(width, height){
        var element = this.GetMainElement();
        if(_aspxIsExistsElement(element)){
            element.style.width = width + "px";
            element.style.height = height + "px";
        }
    },
    GetSize: function(isWidth){
        var element = this.GetMainElement();
        
        if(_aspxIsExistsElement(element))
            return (isWidth ? element.offsetWidth : element.offsetHeight);
        return -1;
    }
});
ASPxClientLabel = _aspxCreateClass(ASPxClientStaticEdit, {
    constructor: function(name) {
        this.constructor.prototype.constructor.call(this, name);                               
    },
    GetValue: function() {    
        var element = this.GetMainElement();
        if(_aspxIsExistsElement(element))
            return element.innerHTML;
    },
    SetValue: function(value) {
        if(value == null)
            value = "";
        var element = this.GetMainElement();
        if(_aspxIsExistsElement(element)) 
            element.innerHTML = value;
    },
    GetText: function(){
        return this.GetValue();
    },
    SetText: function(value){
        this.SetValue(value);
    },
    
	ChangeMainElementAttributes: function(element, method){
	    ASPxClientStaticEdit.prototype.ChangeMainElementAttributes.call(this, element, method);
        method(element, "htmlFor");
	}
});

function aspxSEClick(name, evt){
    var edit = aspxGetControlCollection().Get(name);
    if(edit != null) 
        edit.OnClick(evt);
}