

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");
	}
});
ASPxClientImageBase = _aspxCreateClass(ASPxClientStaticEdit, {
    constructor: function(name) {
        this.constructor.prototype.constructor.call(this, name);
        this.imageWidth = "";
        this.imageHeight = "";
    },
    GetWidth: function(){
        return this.GetSize(true);
    },
    GetHeight: function(){
        return this.GetSize(false);
    },
    SetSize: function(width, height){
        this.imageWidth = width + "px";
        this.imageHeight = height + "px";
        var image = this.GetMainElement();
        if(_aspxIsExistsElement(image))
            ASPxImageUtils.SetSize(image, width, height);
    },
    GetSize: function(isWidth){
        var image = this.GetMainElement();
        if(_aspxIsExistsElement(image))
            return ASPxImageUtils.GetSize(image, isWidth);
        return -1;
    }
});
ASPxClientImage = _aspxCreateClass(ASPxClientImageBase, {
    constructor: function(name) {
        this.constructor.prototype.constructor.call(this, name);
        this.emptyImageUrl = "";
        this.emptyImageWidth = "";
        this.emptyImageHeight = "";
        this.imageAlt = "";
        this.isEmpty = false;
    },
    GetValue: function() {
        if(!this.isEmpty) {
            var image = this.GetMainElement();
            if(_aspxIsExistsElement(image))
                return ASPxImageUtils.GetImageSrc(image);
        }
        return "";
    },
    SetValue: function(value) {
        if(value == null) value = "";
        this.isEmpty = (value == "");
        var image = this.GetMainElement();
        if(_aspxIsExistsElement(image)){
            if(this.emptyImageUrl != ""){
                if(value == "")
                    this.ApplyImageProperties(image, this.emptyImageUrl, this.emptyImageWidth, this.emptyImageHeight, this.emptyImageAlt);
                else
                    this.ApplyImageProperties(image, value, this.imageWidth, this.imageHeight, this.imageAlt);
            }
            else
                ASPxImageUtils.SetImageSrc(image, value);
        }
    },
    ApplyImageProperties: function(imageElement, url, width, height, alt){
        ASPxImageUtils.SetImageSrc(imageElement, url);
        imageElement.style.width = width;
        imageElement.style.height = height;
        imageElement.alt = alt;
    },
    GetImageUrl: function(url){
        return this.GetValue();
    },
    SetImageUrl: function(url){
        this.SetValue(url);
    }
});
ASPxClientBinaryImage = _aspxCreateClass(ASPxClientImageBase, {
    constructor: function(name) {
        this.constructor.prototype.constructor.call(this, name);
    },
    GetValue: function() {
        return "";
    },
    SetValue: function(value) {
    }
});
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;
    },
    SetVisible: function(visible){
        if(this.clientVisible != visible){
            this.clientVisible = visible;
            var element = this.GetMainElement();
            if(!visible)
                element.style.display = "none";
            else if((element.style.width != "" || element.style.height != "") && !__aspxNetscapeFamily)
                element.style.display = "inline-block";
            else
                element.style.display = "";
        }
    },
    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);
}
