Moo.setLang({
	"moo.field.email" : "merci de renseigner un email valide (ex: fitnessresa@resamania.fr)"
});
Moo.namespace('LMC');
Moo.namespace('LMC.Customer');

LMC.Index = {
    
    initialize : function() {
	    this.container = new Element('div', {
		    id : 'container'
	    }).inject(document.body);
	    
	    this.container.setStyles({
	        width : 980,
	        position : 'relative',
	        height : '500px',
	        'margin-left' : 'auto',
	        'margin-right' : 'auto'
	    }).addClass('lmc-customer-background');
	    this.container.setStyle('top', 0);
	    
	    // Logo place
	    var fitnessresalogo = new Element('div', {
		    id : 'LOGO'
	    }).addClass('lmc-logo_fitness_resa').setStyles({
	        position : 'absolute',
	        cursor : 'pointer',
	        'left' : 80,
	        'top' : 20
	    }).addEvent('click', function() {
		    window.location.href = document.location.href;
	    }).inject(this.container);
	    
	    var supplierlogo = new Element('div', {
		    id : 'LOGO'
	    }).setStyles({
	        position : 'absolute',
	        cursor : 'pointer',
	        'left' : 200,
	        'top' : 20
	    }).inject(this.container);
	    
	    if (Resamania.supplierId) {
		    ResamaniaRemote.getSupplier(Resamania.supplierId, {
			    callback : function(supplier) {
				    if ($defined(supplier.storedFileId)) {
					    var imageContainer = new Element('div').inject(supplierlogo);
					    Resamania.Utils.injectAndResizeImage(imageContainer, {
					        maxWidth : undefined,
					        maxHeight : 103,
					        storedFiledId : supplier.storedFileId
					    });
				    }
			    }.safeBind(this)
		    });
	    }
	    
	    var html = '<b><center>Bienvenue sur le Fitness\'Resa</center><br />';
	    html += '<center>L\'outil de planification et de réservation en ligne de LES MILLS COACH !</center><br />';
	    html += '<center>En cas de question sur cette application, n\'hésitez pas à contacter notre support : <br />08 92 23 03 86 puis tapez le code service :  99887 <i>(0,34€/min)</i></center></b> ';
	    
	    var textContainer = new Element('div').setStyles({
		    'text-align' : 'left'
	    }).set('html', html);
	    
	    // SupplierList Place
	    this.supplierList = new Supplier.form.Filter({
	        hideLabel : true,
	        comboOptions : {
	            emptyValue : -1,
	            emptyLabel : 'Selectionnez un club dans la liste suivante',
	            inputCls : 'lmc-moo-combo-input',
	            triggerCls : 'lmc-moo-icon-combo-down',
	            listCls : 'lmc-moo-combo-list',
	            items : this.activityList,
	            value : 0,
	            onChange : function() {
		            if (this.supplierList.getValue() == -1) {
			            this.profilPanel.hide();
		            } else {
			            this.profilPanel.show();
		            }
	            }.safeBind(this)
	        }
	    });
	    
	    // Box Place
	    var box = new Moo.Box({
	        containerCls : 'lmc-moo-plainbox4',
	        content : [ textContainer, this.supplierList ],
	        'width' : 500
	    }).setStyles({
	        'margin-left' : 50,
	        position : 'absolute',
	        cursor : 'pointer',
	        'left' : 70,
	        'top' : 140
	    }).inject(this.container);
	    
	    // Creation du pavé de connexion
	    this.profilWidget = new LMC.ProfilUnlogged({
	        onTryToConnect : function(authenticationRequest) {
		        Moo.showLoader(Moo.getLang('moo.commons.loading'));
		        this.login(authenticationRequest);
	        }.safeBind(this),
	        onForgetPassword : function(opener, currentMail) {
		        Customer.openForgetPassword(opener, currentMail, 'moo-orangebutton');
	        }.safeBind(Customer)
	    });
	    
	    // Creation du panel contenant le pavé
	    this.profilPanel = new Moo.Panel({
	        width : 250,
	        containerCls : 'moo-nicepanel',
	        title : 'Pavé de connexion',
	        collapsible : false,
	        body : this.profilWidget.getContent()
	    }).setStyles({
	        'margin-left' : 50,
	        position : 'absolute',
	        cursor : 'pointer',
	        'left' : 190,
	        'top' : 300
	    }).inject(this.container).hide();
	    
	    // on va populer la combo des supplier
	    ResamaniaRemote.listBySupplierParam('lmc_issupplier', 'true', {
		    callback : function(list) {
			    var supplierList = list;
			    var supplierId = null;
			    if ($defined(Resamania.supplierId) && (Resamania.supplierId != null)) {
				    for ( var i = 0; i < list.length; i++) {
					    if (list[i].id == Resamania.supplierId) {
						    supplierList = [ list[i] ];
						    supplierId = list[i].id;
					    }
				    }
			    }
			    this.supplierList.combo.setComboItems(supplierList);
			    if (supplierId != null) {
				    this.supplierList.setValue(supplierId);
				    this.profilPanel.show();
			    }
			    Moo.hideLoader();
		    }.safeBind(this)
	    });
    },
    
    login : function(authenticationRequest) {
	    // on ajoute le suppleirId et le authtype à la request
	    authenticationRequest.supplierId = this.supplierList.getValue();
	    authenticationRequest.authTypeId = AuthType.LesMills;
	    Moo.showLoader(Moo.getLang('moo.commons.loading'));
	    Resamania.login(authenticationRequest);
    }
};

LMC.ProfilUnlogged = new Class({
    
    Extends : Moo.Component,
    options : {
        onTryToConnect : $empty,
        onForgetPassword : $empty,
        onProfilCreation : $empty
    },
    
    Implements : Moo.Langable,
    $lang : {
        passwordInputValue : '',
        emailInputValue : 'resamania.customer.profil.unlogged.emailInputValue',
        connectLabel : 'resamania.customer.profil.unlogged.connectLabel',
        forgetPasswordLabel : 'resamania.customer.profil.unlogged.forgetPasswordLabel',
        saveCookieLabel : 'resamania.customer.profil.unlogged.saveCookieLabel',
        createProfilLabel : 'resamania.customer.profil.unlogged.createProfilLabel'
    },
    
    initialize : function(options) {
	    // options
	    this.setOptions(options);
	    
	    this.initializeLang();
	    
	    this.construct();
	    this.myFieldset = new Moo.form.Fieldset({
	        hideIcons : true,
	        items : [ this.myMail, this.myPassword, this.mySaveCookie, this.myForgetPwdLink ]
	    });
	    
    },
    
    getContent : function() {
	    return this.myFieldset;
    },
    
    construct : function() {
	    this.myMail = new Moo.form.TextField({
	        id : 'email',
	        required : true,
	        showEraser : false,
	        width : 200,
	        hideLabel : true,
	        control : 'email',
	        value : this.lang.emailInputValue,
	        // value: this.lang.emailInputValue,
	        enterFn : this.connect.safeBind(this),
	        onFocus : function() {
		        if (this.myMail.field.value == this.lang.emailInputValue) {
			        this.myMail.field.set('value', '');
		        }
	        }.safeBind(this),
	        onBlur : function() {
		        if (this.myMail.field.value == '') {
			        this.myMail.field.set('value', this.lang.emailInputValue);
		        }
	        }.safeBind(this)
	    });
	    this.myMail.field.setStyle('width', 180);
	    
	    this.myPassword = new Moo.form.PasswordField({
	        id : 'password',
	        required : true,
	        showEraser : false,
	        hideLabel : true,
	        value : this.lang.passwordInputValue,
	        enterFn : this.connect.safeBind(this),
	        onFocus : function() {
		        if (this.myPassword.field.value == this.lang.passwordInputValue) {
			        this.myPassword.field.set('value', '');
		        }
	        }.safeBind(this)
	    });
	    this.myPassword.field.setStyle('width', 180);
	    
	    var myTrigger = new Moo.Button({
	        id : 'connect',
	        text : this.lang.connectLabel,
	        containerCls : 'moo-orangebutton',
	        onClick : this.connect.safeBind(this)
	    }).setStyles({
		    'float' : 'right'
	    });
	    myTrigger.injectAfter(this.myPassword.field);
	    
	    this.myForgetPwdLink = new Moo.Link({
	        text : this.lang.forgetPasswordLabel,
	        onClick : function() {
		        this.fireEvent('onForgetPassword', [ this.myForgetPwdLink, (this.myMail.field.value == this.lang.emailInputValue ? '' : this.myMail.field.value) ]);
	        }.safeBind(this)
	    }).addClass('lmc-customer-link');
	    
	    this.mySaveCookie = new Moo.form.CheckboxField({
	        checked : false,
	        fieldCls : '',
	        labelWidth : '',
	        labelText : this.lang.saveCookieLabel,
	        synchroValue : true,
	        checkedValue : true,
	        uncheckedValue : false
	    });
	    this.mySaveCookie.label.setStyles({
		    'padding' : '4px 5px 3px 0px'
	    }).addClass('lmc-customer-link');
	    // invert
	    
    },
    
    connect : function() {
	    if (this.myFieldset.control()) {
		    var authenticationRequest = new AuthenticationRequest();
		    authenticationRequest.mail = this.myMail.field.value;
		    authenticationRequest.password = this.myPassword.field.value;
		    authenticationRequest.memorize = this.mySaveCookie.field.checked;
		    this.fireEvent('onTryToConnect', [ authenticationRequest ]);
	    }
    }
});

LMC.Customer = {
    initialize : function() {
	    this.container = new Element('div', {
		    id : 'container'
	    }).inject(document.body);
	    
	    this.container.setStyles({
	        width : 960,
	        position : 'relative',
	        top : '0px',
	        left : '0px',
	        height : '500px',
	        'margin-left' : 'auto',
	        'margin-right' : 'auto'
	    }).addClass('lmc-customer-background');
	    this.container.setStyle('top', 0);
	    
	    var logo = new Element('div', {
		    id : 'LOGO'
	    }).addClass('lmc-logo_fitness_resa').setStyles({
	        position : 'absolute',
	        cursor : 'pointer',
	        'left' : 80,
	        'top' : 20
	    }).addEvent('click', function() {
		    window.location.href = document.location.href;
	    }).inject(this.container);
	    
	    var supplierlogo = new Element('div', {
		    id : 'LOGO'
	    }).setStyles({
	        position : 'absolute',
	        cursor : 'pointer',
	        'left' : 200,
	        'top' : 20
	    }).inject(this.container);
	    
	    if (Resamania.supplierId) {
		    ResamaniaRemote.getSupplier(Resamania.supplierId, {
			    callback : function(supplier) {
				    if ($defined(supplier.storedFileId)) {
					    var imageContainer = new Element('div').inject(supplierlogo);
					    Resamania.Utils.injectAndResizeImage(imageContainer, {
					        maxWidth : undefined,
					        maxHeight : 103,
					        storedFiledId : supplier.storedFileId
					    });
				    }
			    }.safeBind(this)
		    });
	    }
	    
	    if (Resamania.user == null) {
		    window.location.href = './index.html';
	    } else {
		    CustomerRemote.initialise({
		        callback : function(customerScreen) {
			        this.afterInitialize(customerScreen);
		        }.safeBind(this),
		        errorHandler : function(errorString, exception) {
			        Resamania.exceptionsHandler(errorString, exception);
		        }
		    });
	    }
    },
    
    afterInitialize : function(customerScreen) {
	    if ($defined(customerScreen.searchWidgetForActivity)) {
		    for ( var i = 0; i < customerScreen.searchWidgetForActivity.length; i++) {
			    Resamania.setEntryDetails('activity', customerScreen.searchWidgetForActivity[i]);
		    }
	    }
	    if ($defined(customerScreen.searchWidgetForCoach)) {
		    for ( var i = 0; i < customerScreen.searchWidgetForCoach.length; i++) {
			    Resamania.setEntryDetails('coach', customerScreen.searchWidgetForCoach[i]);
		    }
	    }
	    if ($defined(customerScreen.searchWidgetForRoom)) {
		    for ( var i = 0; i < customerScreen.searchWidgetForRoom.length; i++) {
			    Resamania.setEntryDetails('room', customerScreen.searchWidgetForRoom[i]);
		    }
	    }
	    
	    if ($defined(customerScreen.user) && (customerScreen.user != null)) {
		    this.userLogged = customerScreen.user;
		    this.logged = $defined(this.userLogged.id);
		    Customer.userLogged = this.userLogged;
	    } else {
		    this.logged = false;
	    }
	    this.customerScreen = customerScreen;
	    Customer.logged = this.logged;
	    this.customerScreen = customerScreen;
	    Customer.customerScreen = this.customerScreen;
	    
	    this.createWorkPlace();
	    this.createSearchPlace();
	    this.createProfilPlace();
	    
	    Moo.hideLoader();
    },
    
    createSearchPlace : function() {
	    this.searchPlace = new Element('div', {
		    id : 'searchPlace'
	    }).setStyles({
	        position : 'absolute',
	        'width' : 960
	    }).inject(this.container);
	    this.createActivitySearchWidget();
	    this.createCoachSearchWidget();
    },
    
    createWorkPlace : function() {
	    this.workPlace = new Element('div', {
		    id : 'workPlace'
	    }).setStyles({
	        position : 'absolute',
	        'margin-top' : 150,
	        'width' : 960
	    }).inject(this.container).hide();
	    this.resultPanel = new Moo.Panel({
	        styles : {
	            position : 'relative',
	            top : 10
	        },
	        width : '100%',
	        height : '100%',
	        containerCls : 'lmc-customer-panel',
	        id : 'result',
	        collapsible : false
	    }).inject(this.workPlace);
    },
    
    createProfilPlace : function() {
	    this.profilPlace = new Element('div', {
		    id : 'profilPlace'
	    }).setStyles({
	        position : 'absolute',
	        left : 755,
	        width : 220,
	        top : 15
	    }).inject(this.container);
	    
	    this.workProfilPlace = new Element('div', {
		    id : 'workProfilPlace'
	    }).setStyles({
	        position : 'absolute',
	        'margin-top' : 20,
	        'width' : 960
	    }).inject(this.container).hide();
	    
	    this.creationProfilPanel = new Moo.Panel({
	        styles : {
	            position : 'absolute',
	            top : 150,
	            left : 115
	        },
	        width : 815,
	        containerCls : 'moo-nicepanel',
	        title : this.logged ? Moo.getLang('resamania.customer.profilEdit') : Moo.getLang('resamania.customer.profilCreate'),
	        id : 'profilcreation',
	        collapsible : false
	    }).inject(this.workProfilPlace);
	    
	    this.createProfilWidget();
    },
    
    createActivitySearchWidget : function() {
	    this.searchActivityWidget = new Customer.Search.ActivityWidget({
	        searchWidget : this.customerScreen.searchWidgetForActivity,
	        onSearch : function(searchValues) {
		        this.createResultWidget(searchValues);
	        }.safeBind(this),
	        datevalue : this.getDefaultDate(),
	        // hourValue: this.getDefaultHour(), //FITNESSRESA-18: on ne
			// renseigne pas l'heure par défaut
	        field : {
	            domain : false,
	            location : false,
	            room : false,
	            activity : true,
	            date : true,
	            advanced : false
	        },
	        cls : {
	            domain : {
	                iconCls : 'moo-icon-right',
	                inputCls : 'lmc-moo-combo-input',
	                triggerCls : 'lmc-moo-icon-combo-down',
	                listCls : 'lmc-moo-combo-list'
	            },
	            location : {
	                iconCls : 'moo-icon-right',
	                inputCls : 'lmc-moo-combo-input',
	                triggerCls : 'lmc-moo-icon-combo-down',
	                listCls : 'lmc-moo-combo-list'
	            },
	            room : {
	                iconCls : 'moo-icon-right',
	                inputCls : 'lmc-moo-combo-input',
	                triggerCls : 'lmc-moo-icon-combo-down',
	                listCls : 'lmc-moo-combo-list'
	            },
	            activity : {
	                iconCls : 'moo-icon-right',
	                inputCls : 'lmc-moo-combo-input',
	                triggerCls : 'lmc-moo-icon-combo-down',
	                listCls : 'lmc-moo-combo-list'
	            },
	            date : {
		            iconCls : 'moo-icon-right'
	            },
	            toolbar : {
		            containerCls : 'moo-orangebutton'
	            },
	            advancedLink : {
		            containerCls : 'customer-link3'
	            }
	        }
	    });
	    this.activitySearchWidgetPanel = new Moo.Panel({
	        styles : {
	            position : 'relative',
	            left : 10,
	            'margin-top' : 200,
	            'margin-left' : 60,
	            'float' : 'left'
	        },
	        width : 220,
	        containerCls : 'moo-nicepanel',
	        title : Moo.getLang('resamania.customer.searchWidget.activitySearch'),
	        collapsible : false,
	        collapsed : false,
	        body : this.searchActivityWidget.getContent()
	    }).inject(this.searchPlace);
    },
    
    createCoachSearchWidget : function() {
	    this.searchCoachWidget = new Customer.Search.CoachWidget({
	        searchWidget : this.customerScreen.searchWidgetForCoach,
	        onSearch : function(searchValues) {
		        this.createResultWidget(searchValues);
	        }.safeBind(this),
	        datevalue : this.getDefaultDate(),
	        // hourValue: this.getDefaultHour(), //FITNESSRESA-18: on ne
			// renseigne pas l'heure par défaut
	        field : {
	            domain : false,
	            location : false,
	            domain : false,
	            advanced : false
	        },
	        cls : {
	            domain : {
	                iconCls : 'moo-icon-right',
	                inputCls : 'lmc-moo-combo-input',
	                triggerCls : 'lmc-moo-icon-combo-down',
	                listCls : 'lmc-moo-combo-list'
	            },
	            location : {
	                iconCls : 'moo-icon-right',
	                inputCls : 'lmc-moo-combo-input',
	                triggerCls : 'lmc-moo-icon-combo-down',
	                listCls : 'lmc-moo-combo-list'
	            },
	            coach : {
	                iconCls : 'moo-icon-right',
	                inputCls : 'lmc-moo-combo-input',
	                triggerCls : 'lmc-moo-icon-combo-down',
	                listCls : 'lmc-moo-combo-list'
	            },
	            date : {
		            iconCls : 'moo-icon-right'
	            },
	            toolbar : {
		            containerCls : 'moo-orangebutton'
	            },
	            advancedLink : {
		            containerCls : 'customer-link3'
	            }
	        }
	    });
	    this.coachSearchWidgetPanel = new Moo.Panel({
	        styles : {
	            position : 'relative',
	            left : 10,
	            'margin-top' : 200,
	            'margin-left' : 60,
	            'float' : 'left'
	        },
	        width : 220,
	        containerCls : 'moo-nicepanel',
	        title : Moo.getLang('resamania.customer.searchWidget.coachSearch'),
	        collapsible : false,
	        collapsed : false,
	        body : this.searchCoachWidget.getContent()
	    }).inject(this.searchPlace);
    },
    
    getDefaultDate : function() {
	    var dateValue = new Date();
	    dateValue.setDate(dateValue.getDate() + 1);
	    return dateValue;
    },
    
    getDefaultHour : function() {
	    return '12:00';
    },
    
    createResultWidget : function(searchValues) {
	    this.searchPlace.hide();
	    Moo.empty(this.resultPanel.mainContainer);
	    
	    this.container.removeClass('lmc-customer-background');
	    this.container.addClass('lmc-customer-background2');
	    
	    this.searchValues = searchValues;
	    this.workPlace.show();
	    CustomerRemote.search(searchValues, {
	        callback : function(result) {
		        this.drawResultWidget(result);
	        }.safeBind(this),
	        errorHandler : function(errorString, exception) {
		        Resamania.exceptionsHandler(errorString, exception);
	        }
	    });
    },
    
    drawResultWidget : function(result) {
	    this.resultPanel.setTitle(Moo.getLang('resamania.customer.research.title').format(result.entries.length));
	    this.result = new Customer.Result({
	        result : result,
	        customer : this.userLogged,
	        entryPerPage : 3,
	        parent : this.resultPanel.mainContainer,
	        getEntryDetails : function(type, id) {
		        return Resamania.getEntryDetails(type, id);
	        }.safeBind(this),
	        onModifySearchClick : function() {
		        this.container.removeClass('lmc-customer-background2');
		        this.container.addClass('lmc-customer-background');
		        this.workPlace.hide();
		        this.searchPlace.show();
		        this.resultPanel.show();
	        }.safeBind(this),
	        onDayBeforeClick : function() {
		        Moo.showLoader(Moo.getLang('moo.commons.loading'));
		        this.searchValues.date.setDate(this.searchValues.date.getDate() - 1);
		        this.createResultWidget(this.searchValues);
	        }.safeBind(this),
	        onDayAfterClick : function() {
		        Moo.showLoader(Moo.getLang('moo.commons.loading'));
		        this.searchValues.date.setDate(this.searchValues.date.getDate() + 1);
		        this.createResultWidget(this.searchValues);
	        }.safeBind(this),
	        showBookingPlace : false,
	        showTemporaryBooking : false,
	        cls : {
	            redoSearchButton : {
		            containerCls : 'moo-orangebutton'
	            },
	            dayBeforeButton : {
		            containerCls : 'moo-orangebutton'
	            },
	            dayAfterButton : {
		            containerCls : 'moo-orangebutton'
	            },
	            planningResultPanel : {
	                containerCls : 'moo-nicepanel',
	                planningCls : 'lmc-customer-planning'
	            },
	            entry : {
	                bookingContainer : {
		                containerCls : 'lmc-customer-panel'
	                },
	                activityFilter : {
	                    iconCls : 'moo-icon-right',
	                    inputCls : 'lmc-moo-combo-input',
	                    triggerCls : 'lmc-moo-icon-combo-down',
	                    listCls : 'lmc-moo-combo-list'
	                },
	                coachFilter : {
	                    iconCls : 'moo-icon-right',
	                    inputCls : 'lmc-moo-combo-input',
	                    triggerCls : 'lmc-moo-icon-combo-down',
	                    listCls : 'lmc-moo-combo-list'
	                }
	            }
	        }
	    });
    },
    
    createProfilWidget : function() {
	    this.profilWidget = $empty;
	    var containerCls = '';
	    this.profilWidget = new Customer.ProfilLogged({
	        initialUsr : this.logged ? this.userLogged : null,
	        onEditionProfilClick : this.createEditionProfilWidget.safeBind(this),
	        onBookingClick : function() {
		        this.createEditionProfilWidget();
		        this.creationProfil.switchToReservationTabs();
	        }.safeBind(this),
	        onSupplierClick : function() {
		        Moo.showLoader(Moo.getLang('moo.commons.loading'));
		        document.location.href = 'SupplierHome';
	        },
	        cls : {
	            profil : {
		            containerCls : 'moo-orangebutton'
	            },
	            booking : {
		            linkCls : 'lmc-customer-link3'
	            },
	            supplier : {
		            linkCls : 'lmc-customer-link3'
	            },
	            logout : {
		            linkCls : 'lmc-customer-link3'
	            }
	        }
	    });
	    containerCls = 'moo-nicepanel';
	    this.profilPanel = new Moo.Panel({
	        styles : {
	            'float' : 'right',
	            position : 'relative'
	        },
	        width : 198,
	        containerCls : containerCls,
	        title : Moo.getLang('resamania.customer.profilTitle'),
	        collapsible : false,
	        body : this.profilWidget.getContent()
	    }).inject(this.profilPlace);
	    this.profilPanel.headerContainer.setStyle('cursor', 'pointer').addEvent('click', function() {
		    this.profilPanel.toggleSlide();
	    }.safeBind(this));
	    
    },
    
    createEditionProfilWidget : function() {
	    this.searchPlace.hide();
	    this.workPlace.hide();
	    this.workProfilPlace.show();
	    
	    this.container.removeClass('lmc-customer-background');
	    this.container.addClass('lmc-customer-background2');
	    
	    var civilityList = [ {
	        id : 0,
	        name : Moo.getLang('resamania.customer.profil.civility.ms')
	    }, {
	        id : 2,
	        name : Moo.getLang('resamania.customer.profil.civility.miss')
	    }, {
	        id : 3,
	        name : Moo.getLang('resamania.customer.profil.civility.mr')
	    } ];
	    var statusList = [ {
	        id : 0,
	        name : Moo.getLang('resamania.customer.profil.status.yes')
	    }, {
	        id : 1,
	        name : Moo.getLang('resamania.customer.profil.status.no')
	    } ];
	    this.creationProfil = new Customer.Profil.Edition({
	        civilityItems : civilityList,
	        statusItems : statusList,
	        initialUsr : this.logged ? this.userLogged : null,
	        onValidation : function(isalreadyCreate, datas) {
		        CustomerRemote.updateProfil(datas, {
		            callback : function(user) {
			            Moo.hideLoader();
			            this.userLogged = user;
			            Moo.alert({
			                title : Moo.getLang('resamania.customer.profil.accountAfterModification.title'),
			                body : Moo.getLang('resamania.customer.profil.accountAfterModification.body'),
			                okCls : 'moo-orangebutton'
			            });
			            
			            this.container.removeClass('lmc-customer-background2');
			            this.container.addClass('lmc-customer-background');
			            this.searchPlace.show();
			            this.workPlace.hide();
			            this.workProfilPlace.hide();
		            }.safeBind(this),
		            errorHandler : function(errorString, exception) {
			            Resamania.exceptionsHandler(errorString, exception);
		            },
		            exceptionHandler : function(errorString, exception) {
			            Moo.hideLoader();
			            if (errorString == 'USR_ALREADY_EXISTS') {
				            Moo.alert({
				                title : Moo.getLang('resamania.customer.profil.accountAfterModification.title'),
				                body : Moo.getLang('resamania.customer.profil.accountAfterModification.errorEmail'),
				                okCls : 'moo-orangebutton'
				            });
			            } else {
				            Resamania.exceptionsHandler(errorString, exception);
			            }
		            }
		        });
	        }.safeBind(this),
	        onCancel : function() {
		        this.container.removeClass('lmc-customer-background2');
		        this.container.addClass('lmc-customer-background');
		        this.searchPlace.show();
		        this.workPlace.hide();
		        this.workProfilPlace.hide();
	        }.safeBind(this),
	        cls : {
	            tabs : {
	                containerCls : 'lmc-customer-tabs',
	                togglerCls : 'lmc-customer-tabs-toggler'
	            },
	            validationButton : {
		            containerCls : 'moo-orangebutton'
	            },
	            cancelButton : {
		            containerCls : 'moo-orangebutton'
	            },
	            generalInformation : {
	                type : {
	                    inputCls : 'moo-combo-input',
	                    triggerCls : 'moo-icon-combo-down',
	                    listCls : 'moo-combo2-list'
	                },
	                civility : {
		                iconCls : 'lmc-input3'
	                },
	                name : {
		                iconCls : 'lmc-input3'
	                },
	                lastname : {
		                iconCls : 'lmc-input3'
	                },
	                address : {
		                iconCls : 'lmc-input3'
	                },
	                postcode : {
		                iconCls : 'lmc-input3'
	                },
	                city : {
		                iconCls : 'lmc-input3'
	                },
	                cellphone : {
		                iconCls : 'lmc-input3'
	                },
	                homephone : {
		                iconCls : 'lmc-input3'
	                },
	                mail : {
		                iconCls : 'lmc-input3'
	                },
	                firstpassword : {
		                iconCls : 'lmc-input3'
	                },
	                secondpassword : {
		                iconCls : 'lmc-input3'
	                },
	                modifypassword : {
	                    linkCls : 'moo-link',
	                    popupCls : 'moo-nicepanel',
	                    popupButtonCls : 'moo-orangebutton'
	                }
	            },
	            booking : {
	                futureReservationPanel : {
		                containerCls : 'moo-nicepanel'
	                },
	                pastReservationPanel : {
		                containerCls : 'moo-nicepanel'
	                }
	            },
	            abo : {
		            aboPanel : {
			            containerCls : 'moo-nicepanel'
		            }
	            }
	        }
	    });
	    
	    Moo.empty(this.creationProfilPanel.mainContainer);
	    this.creationProfilPanel.setBody(this.creationProfil);
    }
};

Moo.window.Window.prototype.options.containerCls = 'lmc-moo-window';
Moo.window.Alert.prototype.options.containerCls = 'lmc-moo-window';
Moo.window.Alert.prototype.options.okCls = 'moo-orangebutton';

Customer.Booking.prototype.options.modifyCustomerEnable = false;
Customer.Booking.prototype.options.optionEnable = false;
Customer.Booking.prototype.options.cls.addMeButton.containerCls = 'moo-orangebutton';
Customer.Booking.prototype.options.cls.removeMeButton.containerCls = 'moo-orangebutton';

Customer.defaultClsForButton = 'moo-orangebutton';

