function View(
    LeadID,
    ListControlID,
    ListControlGridClass,
    ListControlListClass,
    ListButtonControlID,
    GridButtonControlID,
    ListButtonImageOn,
    ListButtonImageOff,
    GridButtonImageOn,
    GridButtonImageOff
){
    this.leadID = LeadID;
    this.listControlID = ListControlID;
    this.listControlGridClass = ListControlGridClass;
    this.listControlListClass = ListControlListClass;
    this.listButtonControlID = ListButtonControlID;
    this.gridButtonControlID = GridButtonControlID;
    this.listButtonImageOn = ListButtonImageOn;
    this.listButtonImageOff = ListButtonImageOff;
    this.gridButtonImageOn = GridButtonImageOn;
    this.gridButtonImageOff = GridButtonImageOff;

    this.SetView = function(view)
    {
        AIKON.eNekretnineLive.WebServices.WebService.Lead_SetView(this.leadID, view);
        this.SetView_SucceededCallback(view);
    }

    this.SetView_SucceededCallback = function(result)
    {
        var view = result;
        
        var objList = $("#" + this.listControlID)[0];
        var objListButton = $("#" + this.listButtonControlID)[0];
        var objGridButton = $("#" + this.gridButtonControlID)[0];
        
        if (objList != null) {
            if (view == 'list')
            {
                objList.className = this.listControlListClass;
                objListButton.src = this.listButtonImageOn;
                objGridButton.src = this.gridButtonImageOff;
            }
            else if (view == 'grid')
            {
                objList.className = this.listControlGridClass;
                objListButton.src = this.listButtonImageOff;
                objGridButton.src = this.gridButtonImageOn;
            }
        }
    }
}
