$(document).ready(function() {
////Validation
    var name = new LiveValidation('name');
        name.add( Validate.Format, { pattern: /^\s*[a-zA-Z0-9,\s]+\s*$/ } );
        name.add( Validate.Length, { minimum: 3, maximum: 12 , failureMessage: "Please enter a valid name" } );
        name.add( Validate.Presence );

    var type = new LiveValidation('type');
        type.add( Validate.Exclusion, { within: ['notselected', 'Select One'], failureMessage: "Please select an entry from the list" } );
        type.add( Validate.Presence );
   var  difficulty = new LiveValidation('difficulty');
        difficulty.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        difficulty.add( Validate.Presence );
    var description = new LiveValidation('description');
        description.add( Validate.Format, { pattern: /^\s*[a-zA-Z0-9,\s]+\s*$/ } );
        description.add( Validate.Presence );
    var musclearray0 = new LiveValidation('musclearray[0]');
        musclearray0.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray0.add( Validate.Presence );
    var musclearray1 = new LiveValidation('musclearray[1]');
        musclearray1.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray1.add( Validate.Presence );
    var musclearray2 = new LiveValidation('musclearray[2]');
        musclearray2.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray2.add( Validate.Presence );
    var musclearray3 = new LiveValidation('musclearray[3]');
        musclearray3.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray3.add( Validate.Presence );
    var musclearray4 = new LiveValidation('musclearray[4]');
        musclearray4.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray4.add( Validate.Presence );
    var musclearray5 = new LiveValidation('musclearray[5]');
        musclearray5.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray5.add( Validate.Presence );
    var musclearray6 = new LiveValidation('musclearray[6]');
        musclearray6.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray6.add( Validate.Presence );
    var musclearray7 = new LiveValidation('musclearray[7]');
        musclearray7.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray7.add( Validate.Presence );
    var musclearray8 = new LiveValidation('musclearray[8]');
        musclearray8.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray8.add( Validate.Presence );
    var musclearray9 = new LiveValidation('musclearray[9]');
        musclearray9.add( Validate.Numericality, { minimum: 1, maximum: 10,  onlyInteger: true, failureMessage: "Must be a number between 1 and 10" });
        musclearray9.add( Validate.Presence );

// Pass a function that checks if a number is divisible by one that you pass it in args object
// In this case, 5 is passed, so should return true and validation will pass
//Validate.Custom( 55, { against: function(value,args){ return !(value % args.divisibleBy) }, args: {divisibleBy: 5} } );

// $.ajax({
//     type: 'get',
//     url: '/admin/exercises/',
//     data: { name: 'Cheddar'}
// });


// $.getJSON('admin/exercise', function(data) {
//   var items = [];
 
//   $.each(data, function(key, val) {
//     items.push('<li id="' + key + '">' + val + '</li>');
//   });
 
//   $('<ul/>', {
//     'class': 'my-new-list',
//     html: items.join('')
//   }).appendTo('body');
// });



});