﻿$(".mainContent").prettyBorders({ top: 11, right: 11, bottom: 22, left: 11, bgImagePre: imagePath + "image/contentContainerBG_0", bgImageExt: "png", addTitle: false });
$('h3.helptitle').next().hide();

$(document).ready(function() {
    // Add click handlers
    $('h3.helptitle').click(function() {
        $(this).toggleClass("selected").next().toggle();
        return false;
    }).next().hide();
    $('span.expander').click(function() {
        $('h3.helptitle').each(function(intIndex) {
            $(this).attr("class", "helptitle selected").next().show();
        });
    });
    $('span.collapser').click(function() {
        $('h3.helptitle').each(function(intIndex) {
            $(this).attr("class", "helptitle normal").next().hide();
        });
    });
    $('ul#atoz').html("");
    // Clone list items and then sort alphabetically
    $('div.helplist li').clone().appendTo('ul#atoz');
    $('ul#atoz li').removeClass("lastchild");
    $('ul#atoz li').sort(function(left, right) {
        var keyL = $.trim($(left).children('a').text().toUpperCase());
        var keyR = $.trim($(right).children('a').text().toUpperCase());
        if (keyL < keyR) return -1;
        if (keyL > keyR) return 1;
        return 0;
    }).each(function(index, row) {
        $('ul#atoz').append(row);
    });

    //Remove duplicates
    var a = new Array();
    $('ul#atoz li').children("a").each(function(x) {
        test = false;
        b = a[x] = $(this).text();
        for (i = 0; i < a.length - 1; i++) {
            if (b == a[i]) {
                test = true;
                break;
            }
        }
        if (test) $(this.parentNode).remove();
    });
});
