﻿var showDocumentListTitle = "true";

$(document).ready(function () {

    jQuery.fn.exists = function () { return jQuery(this).length > 0; }

    if ($('#banner div.rotator-pics').exists()) $('#banner div.rotator-pics').cycle({
        fx: 'fade',
        activePagerClass: 'selected',
        pager: '.pagination'
    });

    $('select.ddlCountryList').change(function () {
        ($(this).val() == "Australia") ? $('.state-dropdown-list').show() : $('.state-dropdown-list').hide();
    });

    $('.right-column .newsList').addClass('newsPanel');
    $('.newsPanel .panel:gt(0)').hide();
    $('.newsPanel h3:first-child').addClass('selected');

    var i;
    for (i = 0; i < $('div.newsPanel h3').length; i++) {
        $('div.newsPanel h3:eq(' + i + ')').css('left', 5 + 60 * i + 'px');
    }

    $('div.newsPanel h3').click(function () {
        $('div.newsPanel .panel').hide();
        $(this).addClass('selected')
		.siblings('h3').removeClass('selected');
        $(this).next('.panel').show();
    });

    $('.styleswitch').bind('click', function (e) {
        $.stylesheetSwitch(this.getAttribute('rel'));
        return false;
    });

    for (var i = 0; i < $('#banner div.rotator-pics .panel').length; i++) {

    }

    var i = 0;
    $('#banner div.rotator-pics .panel').each(function () {
        i++;
        $(this).addClass('panel-' + i);
        var title = $(this).find('img').attr('title');
        var desc = $(this).find('img').attr('alt');
        $(this).find('.title').text(title);
        $(this).find('.desc').text(desc);
    });

    if (showDocumentListTitle == "true")
        $('div.list-container').each(function () {
            var libraryTitle = $(this).find('ul li:first-child div.library-name div').text();
            $(this).find('h3.title-library').text(libraryTitle);
        });
        else if (showDocumentListTitle == "false") $('div.list-container h3.title-library').hide();

       
});


