$(document).ready(function () {
    $("#slides").slides({
        preload: true,
        play: 6000,
        hoverPause: true,
        pause: 2000,
        slideSpeed: 500
    });
    $('#Forename').watermark('First Name', { useNative: false });
    $('#Surname').watermark('Last Name', { useNative: false });
    $('#Email').watermark('Email Address', { useNative: false });

    // Reset Font Size
    var originalFontSize = $('html').css('font-size');
    $(".resetFont").click(function () {
        $('html').css('font-size', originalFontSize);
    });
    // Increase Font Size
    $(".increaseFont").click(function () {
        var currentFontSize = $('html').css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum * 1.2;
        $('html').css('font-size', newFontSize);
        return false;
    });
    // Decrease Font Size
    $(".decreaseFont").click(function () {
        var currentFontSize = $('html').css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum * 0.8;
        $('html').css('font-size', newFontSize);
        return false;
    });

    //char counter
    // get current number of characters
    $('#titlecounter').html('70 characters remaining');

    $('#main_Title').keyup(function () {
        // get new length of characters
        $('#titlecounter').html((70 - $(this).val().length) + ' characters remaining');
    });

    $('#locationcounter').html('70 characters remaining');

    $('#main_Location').keyup(function () {
        // get new length of characters
        $('#locationcounter').html((70 - $(this).val().length) + ' characters remaining');
    });

    $('#desccounter').html('280 characters remaining');

    $('#main_Description').keyup(function () {
        // get new length of characters
        $('#desccounter').html((280 - $(this).val().length) + ' characters remaining');
    });

    $('#proddesccounter').html('700 characters remaining');

    $('#main_ProdDescription').keyup(function () {
        // get new length of characters
        $('#proddesccounter').html((700 - $(this).val().length) + ' characters remaining');

        var text = $(this).val();
        var chars = text.length;

        if (chars > 700) {
            var new_text = text.substr(0, 700);
            $(this).val(new_text);
        }
    });

    $('#pricingcounter').html('35 characters remaining');
    $('#batapricingcounter').html('35 characters remaining');

    $('#main_Pricing').keyup(function () {
        // get new length of characters
        $('#pricingcounter').html((35 - $(this).val().length) + ' characters remaining');
    });

    $('#main_BataPricing').keyup(function () {
        // get new length of characters
        $('#batapricingcounter').html((35 - $(this).val().length) + ' characters remaining');
    });

    $('#products div:nth-child(4n)').addClass('prod-right');

    $('.event:odd').addClass('right');
});
