//==============================================================================
// Project: Accordion Control
// Company: Hyperon Technology
// Version: 1.0.0
// License: Commercial
//==============================================================================

$(document).ready(function () {

    // Accordion 1	 
    $('.accordionButton').click(function () {
        $('.accordionButton').children().animate({ "width": 0 }, 0);
        $(this).children().animate({ "width": 10 }, 200);
        $('.accordionContent').slideUp('normal');
        if ($(this).next().is(':hidden') == true) { //|| $(this).next().is(':animated')
            $(this).children().animate({ "width": 10 }, 200);
            $(this).next().slideDown('normal');
        }
        $('.page-footer').show();
        $('.page-footer-project').hide();
    });

    /*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
    $('.accordionButton').mouseover(function () {
        $(this).children().animate({ "width": 10 }, 200)
    }).mouseout(function () {
        if ($(this).next().is(':hidden') == true) {
            $(this).children().animate({ "width": 0 }, 200)
        }
    });


    // Hide all on page load
    $('.accordionContent').hide();

    // Show first
    //$('.accordionButton').prepend('<div class="yellow-bar" ><img src="images/yellow_bar.png" /></div>');
    $('.accordionButton').prepend('<div style="background-color:#ffff00; height: 3px; width:0px; "></div>');
    $('.accordionButton').children().animate({ "width": 0 }, 200);
    $('.accordionButton').children().first().animate({ "width": 10 }, 1);

    //**********************************************************
    // Accordion 2	 
    //**********************************************************
    $('.accordion2Button').click(function () {
        $('.accordion2Button').removeClass('on2');
        if ($(this).next().is(':hidden') == true) {

            $('.accordion2Button').hide();
            $('.accordion2Content').hide();

            $(this).slideDown('normal');
            $(this).addClass('on2');
            $(this).next().slideDown('normal');
            $('.page-footer').hide();
            $('.page-footer-project').show();

            //TODO:Show first photo
        } else {
            $(this).addClass('on2');
        }
    });

    $('.page-footer-project').click(function () {
        $('.accordion2Button').slideDown('normal')
        $('.accordion2Content').slideUp('normal');
        $('.page-footer').show();
        $('.page-footer-project').hide();
    });

    /*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
    $('.accordion2Button').mouseover(function () {
        $(this).addClass('over2');
    }).mouseout(function () {
        $(this).removeClass('over2');
    });

    // Hide all on page load
    $('.accordion2Content').hide();
    $('.page-footer').show();
    $('.page-footer-project').hide();

});

