﻿//===============================================================================
// * Namespace:   YouFound.ValidationElements
// * Description: Provides a common definition for all types of field validators
//                as they would otherwise need to be replicated through various
//                parts of the project.
//===============================================================================

$(function () {
    YouFound.ValidationElements = (function () {

        return {

            //################################################################################
            // ##########  BUSINESS DETAILS VALIDATION (ADMIN and SITE ADMIN areas) ##########
            //################################################################################

            UsernameAdminAreaField: new FormValidator.Element('usernameAdminAreaField', {
              rules: {
                required: { error: 'Please enter your username.' },
                alphanum: { error: 'Only letters, numbers and "_" char are allowed.' },
                minlength: { length: 2, error: 'Your username needs to be at least 2 characters long.' },
                maxlength: { length: 50, error: 'Your username can not be more then 50 characters long.' },
                ajax: { multipleParam: true, url: '/AjaxCommon/IsValidUserNameAdminArea', error: 'This username is already taken.', cache: true }
              },
              valid: 'This username is available.'
            }),

            // Shortcut field
            RelativeShortcutUrlAdminAreaField: new FormValidator.Element('relativeShortcutUrlAdminAreaField', {
              rules: {
                required: { error: 'Please enter your shortcut address.' },
                minlength: { length: 0, error: 'Shortcut address should be equal or more than 2 symbols.' },
                regexp: { regexp: /^[\d\w-_]+$/, error: 'Shortcut must contain numbers (0-9) and letters (a-z) and "-" or "_".' },
                ajax: { multipleParam: true, url: '/AjaxCommon/IsValidShortcutUrlAdminArea', error: 'This url shortcut is already taken.', cache: true }
              },
              valid: 'Congratulations, the shortcut URL is available.'
            }),

            // Email
            EmailAdminAreaField: new FormValidator.Element('emailAdminAreaField', {
              rules: {
                required: { error: 'Please enter your email address.' },
                email: { error: 'The email address must be valid as it will be used to confirm your subscription.' },
                ajax: { multipleParam: true, url: '/AjaxCommon/IsValidUserEmailAdminArea', error: 'This email address is already associated with an account', cache: true }
              },
              valid: 'This email address is Ok!'
            }),

            // Business name
            BusinessNameAdminAreaField: new FormValidator.Element('businessNameAdminAreaField', {
              rules: {
                required: { error: 'Please enter the name of your business.' },
                ajax: { multipleParam: true, url: '/AjaxCommon/IsValidBusinessNameAdminArea', error: 'This business name is already taken.', cache: false }
              },
              valid: 'This business name is available.'
            }),

            // Company ABN
            CompanyABNAdminAreaField: new FormValidator.Element('companyABNAdminAreaField', {
              rules: {
                required: { error: 'Field is empty. Please fill it.' },
                maxlength: { length: 15, error: 'Field must be less then 15 chars.' },
                ajax: { multipleParam: true, url: '/AjaxCommon/IsValidABNAdminArea', error: 'This ABN is already taken.', cache: false }
              },
              valid: 'Ok!'
            }),

            //####################################################
            // ##########  BUSINESS DETAILS VALIDATION  ##########
            //####################################################

            UsernameField: new FormValidator.Element('UsernameField', {
                rules: {
                    required: { error: 'Please enter your username.' },
                    alphanum: { error: 'Only letters, numbers and "_" char are allowed.' },
                    minlength: { length: 2, error: 'Your username needs to be at least 2 characters long.' },
                    maxlength: { length: 50, error: 'Your username can not be more then 50 characters long.' },
                    ajax: { url: '/AjaxCommon/IsValidUserName', error: 'This username is already taken.', cache: true }
                },
                valid: 'This username is available.'
            }),

            // Email
              EmailField: new FormValidator.Element('EmailField', {
                rules: {
                    required: { error: 'Please enter your email address.' },
                    email: { error: 'The email address must be valid as it will be used to confirm your subscription.' },
                    ajax: { url: '/AjaxCommon/IsValidUserEmail', error: 'This email address is already associated with an account', cache: true }
                },
                valid: 'This email address is Ok!'
            }),

            // Password
            PasswordField: new FormValidator.Element('passwordField', {
                rules: {
                    required: { error: 'Please enter your password.' },
                    minlength: { length: 6, error: 'Password should be at least 6 characters.' },
                    maxlength: { length: 20, error: 'Password should be less then 20 characters.' },
                    regexp: { regexp: /^[\d\w\.,-_]+$/, error: 'Your password must contain numbers (0-9) and letters (a-z). You may also use "." "," "-" "_"' }
                },
                valid: 'Ok!'
            }),

            // Confirm password
            ConfirmPasswordField: new FormValidator.Element('confirmPasswordField', {
                rules: {
                    required: { error: 'Please enter your password.' },
                    minlength: { length: 6, error: 'Password should be at least 6 characters.' },
                    maxlength: { length: 20, error: 'Password should be less then 20 characters.' },
                    regexp: { regexp: /^[\d\w\.,-_]+$/, error: 'Your password must contain numbers (0-9) and letters (a-z). You may also use "." "," "-" "_"' },
                    equalTo: { value: $('#passwordField input'), error: 'Passwords do not match.' }
                },
                valid: 'The password and confirmation password match.'
            }),

            // Business name
              BusinessNameField: new FormValidator.Element('BusinessNameField', {
                rules: {
                    required: { error: 'Please enter the name of your business.' },
                    ajax: { url: '/AjaxCommon/IsValidBusinessName', error: 'This business name is already taken.', cache: false }
                },
                valid: 'This business name is available.'
            }),

            // Shortcut field
            RelativeShortcutUrlField: new FormValidator.Element('relativeShortcutUrlField', {
                rules: {
                    required: { error: 'Please enter your shortcut address.' },
                    minlength: { length: 0, error: 'Shortcut address should be equal or more than 2 symbols.' },
                    regexp: { regexp: /^[\d\w-_]+$/, error: 'Shortcut must contain numbers (0-9) and letters (a-z) and "-" or "_".' },
                    ajax: { url: '/AjaxCommon/IsValidShortcutUrl', error: 'This url shortcut is already taken.', cache: true }
                },
                valid: 'Congratulations, the shortcut URL is available.'
            }),

            // Business category
            CategoryField: new FormValidator.SelectElement('categoryField', {
                rules: {
                    required: { error: 'Please select your businesses category.' }
                },
                valid: 'Ok!'
            }),

            // Business Industry
            IndustryField: new FormValidator.SelectElement('industryField', {
                rules: {
                    required: { error: 'Please select your businesses industry.' }
                },
                valid: 'Ok!'
            }),

            // Country
            CountryField: new FormValidator.SelectElement('countryField', {
              rules: {
                required: { error: 'Please select the country your business is in.' }
              },
              valid: 'Ok!'
            }),

            // State
            StateField: new FormValidator.SelectElement('stateField', {
                rules: {
                    required: { error: 'Please select the state your business is in.' }
                },
                valid: 'Ok!'
            }),

              //Region
              RegionField: new FormValidator.SelectElement('regionField', {
                rules: {
                  required: { error: 'Please select the region your business is in.' }
                },
                valid: 'Ok!'
              }),

            // Area
            AreaField: new FormValidator.SelectElement('areaField', {
                rules: {
                    required: { error: 'Please select the area your business is in.' }/*,
                    ajax: { url: '/AjaxCommon/IsValidAreas', error: 'Error', cache: false }*/
                },
                valid: 'Ok!'
            }),

            // Company ABN
              CompanyABNField: new FormValidator.Element('ABNField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 15, error: 'Field must be less then 15 chars.' },
                    ajax: { url: '/AjaxCommon/IsValidABN', error: 'This ABN is already taken.', cache: false }
                },
                valid: 'Ok!'
            }),

            TermsAgreeField: new FormValidator.CheckElement('TermsAgreeField', {
                rules: {
                    required: { error: 'You must agree to the Terms and Contidions of the site to create an account.' }
                }
            }),

            //###################################################
            // ##########  CONTACT DETAILS VALIDATION  ##########
            //###################################################


            FirstNameField: new FormValidator.Element('FirstNameField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 50, error: 'Field must be less then 50 chars.' }
                },
                valid: 'Ok!'
            }),

            SurnameField: new FormValidator.Element('LastNameField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 50, error: 'Field must be less then 50 chars.' }
                },
                valid: 'Ok!'
            }),
            
            //UnitSuite
            UnitSuiteField: new FormValidator.Element('unitSuiteField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 25, error: 'Field must be less then 25 chars.' }
                },
                valid: 'Ok!'
            }),

            //Street Number
            StreetNumberField: new FormValidator.Element('streetNumberField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 10, error: 'Field must be less then 10 chars.' }
                },
                valid: 'Ok!'
            }),

            //Street Name
            //Obsolete
            StreetNameField: new FormValidator.Element('streetNameField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 50, error: 'Field must be less then 50 chars.' }
                },
                valid: 'Ok!'
            }),

            //Address
            AddressField: new FormValidator.Element('AddressField', {
              rules: {
                required: { error: 'Field is empty. Please fill it.' },
                maxlength: { length: 50, error: 'Field must be less then 50 chars.' }
              },
              valid: 'Ok!'
            }),

            //Suburb
            SuburbField: new FormValidator.Element('SuburbField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 150, error: 'Field must be less then 150 chars.' }
                },
                valid: 'Ok!'
            }),

            //Postcode
            PostcodeField: new FormValidator.Element('postcodeField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 4, error: 'Field must be less then 4 chars.' }
                },
                valid: 'Ok!'
            }),

            //PhoneNumber
            PhoneNumberField: new FormValidator.Element('phoneNumberField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 15, error: 'Field must be less then 15 chars.' }
                },
                valid: 'Ok!'
            }),

            //FaxNumber
            FaxNumberField: new FormValidator.Element('faxNumberField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 15, error: 'Field must be less then 15 chars.' }
                },
                valid: 'Ok!'
            }),

            //MobileNumber
            MobileNumberField: new FormValidator.Element('mobileNumberField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 15, error: 'Field must be less then 15 chars.' }
                },
                valid: 'Ok!'
            }),

            //WebpageEmailAddress
            WebpageEmailAddressField: new FormValidator.Element('webpageEmailAddressField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 150, error: 'Field must be less then 150 chars.' }
                },
                valid: 'Ok!'
            }),

            //WebAddress
            WebAddressField: new FormValidator.Element('webAddressField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 150, error: 'Field must be less then 150 chars.' }
                },
                valid: 'Ok!'
            }),

            //########################################
            // ##########  PAGE VALIDATION  ##########
            //########################################
            //Navigation Name
            NavNameField: new FormValidator.Element('NavigationNameField', {
                rules: {
                    required: { error: 'Type your navigation name.' },
                    regexp: { regexp: /^[\d\w-_ ]+$/, error: 'Navigation name contain numbers (0-9) and letters (a-z) and "-" or "_".' },
                    maxlength: { length: 15, error: 'Field must be less then 15 chars.' }
                },
                valid: 'Ok!'
            }),

            //Parent Page
            ParentField: new FormValidator.SelectElement('parentField', {
                rules: {
           //         required: { error: 'Please select your parent page.' }
                },
                valid: 'Ok!'
            }),
            
            // Page Heading
            PageHeadingField: new FormValidator.Element('HeadingField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 35, error: 'Field must be less then 35 chars.' },
                    regexp: { regexp: /^[\d\w-_ ]+$/, error: 'Navigation name contain numbers (0-9) and letters (a-z) and "-" or "_".' },
                    ajax: { multipleParam: true, url: '/AjaxCommon/IsHeadingUnique', error: 'This heading is already used for sibling.', 
                            cache: false }
                },
                valid: 'Ok!'
            }),

            // Page Summary
            PageSummaryField: new FormValidator.Element('SummaryField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 250, error: 'Field must be less then 250 chars.' }
                },
                valid: 'Ok!'
            }),

            // Page Keywords
            PageKeywordsField: new FormValidator.Element('KeywordsField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 100, error: 'Field must be less then 100 chars.' }
                },
                valid: 'Ok!'
            }),

            // Page Content
            ContentField: new FormValidator.Element('contentField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 3000, error: 'Field must be less then 3000 chars.' }
                },
                valid: 'Ok!'
            }),

            // Upload file field 0
            UploadFileField0: new FormValidator.FileElement('uploadFileField0', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateFileExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Upload file field 1
            UploadFileField1: new FormValidator.FileElement('uploadFileField1', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateFileExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Upload file field 2
            UploadFileField2: new FormValidator.FileElement('uploadFileField2', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateFileExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Hero image field 0
            HeroImageField0: new FormValidator.FileElement('heroImageField0', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Hero image field 1
            HeroImageField1: new FormValidator.FileElement('heroImageField1', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Hero image field 2
            HeroImageField2: new FormValidator.FileElement('heroImageField2', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Hero image field 3
            HeroImageField3: new FormValidator.FileElement('heroImageField3', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Hero image field 4
            HeroImageField4: new FormValidator.FileElement('heroImageField4', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image field 0
            ImageField0: new FormValidator.FileElement('imageField0', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image field 1
            ImageField1: new FormValidator.FileElement('imageField1', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image field 2
            ImageField2: new FormValidator.FileElement('imageField2', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image field 3
            ImageField3: new FormValidator.FileElement('imageField3', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image field 4
            ImageField4: new FormValidator.FileElement('imageField4', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image field 5
            ImageField5: new FormValidator.FileElement('imageField5', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            //################################################
            // ##########  PHOTOGALLERY VALIDATION  ##########
            //################################################

            // PhotoGalleryFile0 field
            PhotoGalleryFile0: new FormValidator.FileElement('photoGalleryFileField0', {
              rules: {
                required: { error: 'Please select photo.' },
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            //Title
            UploadTitle: new FormValidator.Element('TitleField', {
                rules: {
                    required: { error: 'Please enter title photo.' },
                    minlength: { length: 3, error: 'Field must be at least 3 chars.' },
                    maxlength: { length: 120, error: 'Field must be less then 120 chars.' }
                },
                valid: 'Ok!'
            }),

            //Description
              PhotoGalleryFileDescription0: new FormValidator.Element('DescriptionField', {
                rules: {
                   // required: { error: 'Please enter description photo.' },
                    maxlength: { length: 250, error: 'Field must be less then 250 chars.' }
                },
                valid: 'Ok!'
            }),


            //###########################################
            // ##########  PRODUCT VALIDATION  ##########
            //###########################################


            //ProductCategory
            ProductCategoryField: new FormValidator.SelectElement('productCategoryField', {
                rules: {
                    required: { error: 'Please select your product category.' }
                },
                valid: 'Ok!'
            }),

            //ProductName
            ProductNameField: new FormValidator.Element('productNameField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 64, error: 'Field must be less then 64 chars.' },
                    ajax: { multipleParam: true, url: '/AjaxCommon/IsProductNameUnique', error: 'This product name is already used in current category.',
                        cache: false
                    }
                },
                valid: 'Ok!'
            }),
            
            //Keywords
            KeywordsField: new FormValidator.Element('keywordsField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 128, error: 'Field must be less then 128 chars.' }
                },
                valid: 'Ok!'
            }),

            //Product Code
            ProductCodeField: new FormValidator.Element('productCodeField', {
                rules: {
                    maxlength: { length: 32, error: 'Field must be less then 32 chars.' }
                },
                valid: 'Ok!'
            }),

            //PriceRRP
            PriceRRPField: new FormValidator.Element('priceRRPField', {
                rules: {
                    maxlength: { length: 12, error: 'Field must be less then 12 chars.' }
                },
                valid: 'Ok!'
            }),

            //PriceAmount
            PriceAmountField: new FormValidator.Element('priceAmountField', {
                rules: {
                    maxlength: { length: 12, error: 'Field must be less then 12 chars.' }
                },
                valid: 'Ok!'
            }),

            //PriceUnits
            PriceUnitsField: new FormValidator.Element('priceUnitsField', {
                rules: {
                    maxlength: { length: 32, error: 'Field must be less then 32 chars.' }
                },
                valid: 'Ok!'
            }),

            //Summary
            SummaryField: new FormValidator.Element('summaryField', {
                rules: {
                    required: { error: 'Field is empty. Please fill it.' },
                    maxlength: { length: 500, error: 'Field must be less then 500 chars.' }
                },
                valid: 'Ok!'
            }),

            //Prouct category
            CategoryNameField: new FormValidator.Element('CategoryNameField', {
                rules: {
                     required: { error: 'Field is empty. Please fill it.' },
                     ajax: { multipleParam: true, url: '/AjaxCommon/IsProductCategoryUnique', error: 'This heading is already used for sibling.', 
                            cache: false }
                },
                valid: 'Ok!'
            }),


            //###########################################
            // ##########  DOMAIN VALIDATION  ###########
            //###########################################


            // Domain name
            DomainNameField: new FormValidator.Element('NameField', {
                rules: {
                    required: { error: 'Type your domain name.' }
                },
                valid: 'Ok!'
            }),

            // Map key
            MapKeyField: new FormValidator.Element('MapKeyField', {
              rules: {
                required: { error: 'Type your map key.' }
              },
              valid: 'Ok!'
            }),

            //#########################################
            // ##########  MENU VALIDATION  ###########
            //#########################################


            // Menu name
            MenuNameField: new FormValidator.Element('Menu_TitleField', {
              rules: {
                required: { error: 'Type your menu name.' },
                ajax: { multipleParam: true, url: '/AjaxCommon/IsMenuTitleUnique', error: 'This menu name is already used for current customer.',
                  cache: false }
              },
              valid: 'Ok!'
            }),

            //#########################################
            // ##########  MENU ITEM VALIDATION  ###########
            //#########################################

            // Menu item title
            MenuItemTitleField: new FormValidator.Element('MenuItem_TitleField', {
              rules: {
                required: { error: 'Type your menu item name.' }
              },
              valid: 'Ok!'
            }),

            // Menu item description
            MenuItemDescriptionField: new FormValidator.Element('MenuItem_DescriptionField', {
              rules: {
                required: { error: 'Type your menu item description.' }
              },
              valid: 'Ok!'
            }),

            // Menu item price
            MenuItemPriceField: new FormValidator.Element('MenuItem_PriceField', {
              rules: {
                required: { error: 'Type your menu item price.' }
              },
              valid: 'Ok!'
            }),

            //###################################################
            // ##########  EVENT CALENDAR VALIDATION  ###########
            //###################################################


            // Event title
            TitleField: new FormValidator.Element('TitleField', {
              rules: {
                required: { error: 'Type event title.' },
                ajax: { url: '/AjaxCommon/IsValidEventTitle', error: 'This title is already taken.', cache: false, multipleParam: true }
              },
              valid: 'Ok!'
            }),

            // Venue Id
            VenueIdField: new FormValidator.SelectElement('VenueIdField', {
              rules: {
                required: { error: 'Select venue.' }
              },
              valid: 'Ok!'
            }),

            // Event Date
            EventDateField: new FormValidator.Element('EventDateField', {
              rules: {
                required: { error: 'Select event date.' }
              },
              valid: 'Ok!'
            }),

            // Event Time
            EventTimeField: new FormValidator.Element('EventTimeField', {
              rules: {
                required: { error: 'Select event time.' }
              },
              valid: 'Ok!'
            }),

            // Attachment 0
            AttachmentField0: new FormValidator.FileElement('AttachmentField0', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateFileExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image 0
            ImageField0: new FormValidator.FileElement('ImageField0', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image 1
            ImageField1: new FormValidator.FileElement('ImageField1', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image 2
            ImageField2: new FormValidator.FileElement('ImageField2', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image 3
            ImageField3: new FormValidator.FileElement('ImageField3', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            // Image 4
            ImageField4: new FormValidator.FileElement('ImageField4', {
              rules: {
                ajax: { url: '/AjaxCommon/ValidateImageExtension', error: 'File type is invalid.', cache: false }
              },
              valid: 'Ok!'
            }),

            //##################################################
            // ##########  SERVICE PRICE VALIDATION  ###########
            //##################################################


            // ServicePrice.Description
            Price_DescriptionField: new FormValidator.Element('Price_DescriptionField', {
                rules: {
                    required: { error: 'Type description.' },
                    maxlength: { length: 64, error: 'Field must be less then 64 chars.' }
                },
                valid: 'Ok!'
            }),
            // ServicePrice.Price
            Price_PriceField: new FormValidator.Element('Price_PriceField', {
                rules: {
                    required: { error: 'Type service price.' }
                },
                valid: 'Ok!'
            }),
            // ServicePrice.Quantity
            Price_QuantityField: new FormValidator.Element('Price_QuantityField', {
                rules: {
                    required: { error: 'Type quantity.' }
                },
                valid: 'Ok!'
            })

        };

    })();
});


