﻿$(document).ready(function () {
    $('.nav').removeClass('ns');
    $('#img1').fadeIn('normal').addClass('active');
    $('#t1').fadeIn('fast').addClass('active');

    $('a.title').click(function () {


        if (!$(this).hasClass('selected')) {

            $('.section-links a.title').removeClass('selected');

            $(this).addClass('selected');

            var targetID = $(this).attr("id").replace("link", "img");
            var targetID2 = $(this).attr("id").replace("link", "t");

            if ($('.header-intro img.active').length > 0) {

                $('.header-intro img.active').fadeOut('normal', function () {
                    $('#' + targetID).fadeIn('normal').addClass('active');
                }).removeClass('active');

            } else {

                $('#' + targetID).fadeIn('normal').addClass('active');

            }

            if ($('.header-text.active').length > 0) {

                $('.header-text.active').fadeOut('fast', function () {
                    $('#' + targetID2).fadeIn('fast').addClass('active');
                }).removeClass('active');

            } else {

                $('#' + targetID2).fadeIn('fast').addClass('active');

            }
        }

    });
    $(document).pngFix();
});
