// JavaScript Document
var IndexCycle = -1;

var notepadText = [
        { "Title": "Contestation de contravention (0 &agrave; 3 pts)", "Price": '129<span class="p18">99$*</span>', "IsLongText": true },
        { "Title": "Facult&eacute;s affaiblies", "Price": '', "IsLongText": false },
        { "Title": "Grand exc&egrave;s de vitesse", "Price": '', "IsLongText": false },
        { "Title": "Permis restreint pour fins de travail", "Price": '299<span class="p18">99$*</span>', "IsLongText": true },
        { "Title": "R&eacute;tractation de jugement", "Price": '299<span class="p18">99$*</span>', "IsLongText": false },
        { "Title": "Photo-radar", "Price": '', "IsLongText": false }
   ];

$(document).ready(function () {
    changeNotePadInformation(0);

    $('#screen').cycle({
        fx: 'fade',
        cleartype: true,
        speed: 6000,
        speedIn: 1000,
        speedOut: 1000,
        after: function (currSlideElement, nextSlideElement, options, forwardFlag) {
        },
        before: function (currSlideElement, nextSlideElement, options, forwardFlag) {
            var ImageID = nextSlideElement.id.replace("banner-", "");
            $(".selected").removeClass("selected");
            $("#BanNavBtn" + ImageID).addClass("selected");
            changeNotePadInformation(parseInt(ImageID) - 1);

        }
    });

    $("#bannerNav a").bind("click", function (e) {
        e.preventDefault();
        $('#screen').cycle($("#bannerNav a").index(this));
        if (IndexCycle != -1) {
            $('#screen').cycle('resume');
            IndexCycle = -1;
        }
    });

    if (IndexCycle != -1) {
        changeNotePadInformation(IndexCycle);
        $('#screen').cycle(IndexCycle);
        $('#screen').cycle('pause');
    }
});

function changeNotePadInformation(index) {
    var notepadInfo = notepadText[index];
    $(".notepadTitle").html("<strong>" + notepadInfo.Title + "</strong>");
    var htmlText = ''

    if (notepadInfo.Price != "") {
        htmlText = '<p class="npPrix">' + notepadInfo.Price + '</p>';
        htmlText += '<p class="p14"><strong>Incluant notamment<br />les services juridiques</strong></p>'
    }
    else {
        htmlText = '<br /><br /><br /><p class="p14"><strong>Contactez-nous<br />pour avoir plus d\'information</strong></p><br /><br />';
    }

    $("#notepadPrix").html(htmlText);

    if (notepadInfo.IsLongText) {
        $("#notepadTxt").css("padding", "42px 14px 10px 14px");
    }
    else {
        $("#notepadTxt").css("padding", "49px 14px 10px 14px");
    }
}
