var activePage = 'splash';

function init()
{
    $('#htmlBody').css('visibility', 'visible');
    
    $('a').mouseover(function () {
        $(this).stop().animate({
            color: '#008dff'
        }, 250);
    });

    $('a').mouseout(function () {
        $(this).stop().animate({
            color: '#000000'
        }, 250);
    });

    $('#infiniteLogo').delay(200).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#imaginationsLogo').delay(400).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#leftBar').delay(600).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#leftDiag').delay(800).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#rightBar').delay(1000).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#rightDiag').delay(1200).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#ver7').delay(1400).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#creator').delay(1600).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#let').delay(1000).animate({
        marginLeft: '126px',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#your').delay(1200).animate({
        marginLeft: '102',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#imaginations').delay(1400).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#run').delay(1600).animate({
        marginLeft: '115',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#wild').delay(1800).animate({
        marginLeft: '106',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#work').delay(1200).animate({
        marginLeft: '29',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#history').delay(1400).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#yahooMail').delay(1600).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#googleMail').delay(1800).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#mobilePhone').delay(2000).animate({
        marginLeft: '0',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#menu1').delay(1400).animate({
        marginLeft: '106',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#menu2').delay(1600).animate({
        marginLeft: '106',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#menu3').delay(1800).animate({
        marginLeft: '106',
        opacity: '1'
    }, 1000, 'easeOutExpo');

    $('#contentWork').animate({
        opacity: 0
    }, 0);
}

function gotoWorkHistory()
{
    activePage = 'history';
    $('#menuWork').removeAttr('onclick');
    $('#contentWork').slideDown();

    $('.mainBody').animate({
        transform: 'scale(0.75, 0.75) rotate(270deg)'
    }, 'easeOut');

    $('.mainBody').animate({
        transform: 'scale(1.86, 1.86) rotate(270deg)',
        marginTop: '-310',
        marginLeft: '575px'
    }, 1000, 'easeOutExpo');

    $('#contentWork').delay(400).animate({
        marginTop: '-280px',
        marginLeft: '10px',
        opacity: 1
    }, 1000, 'easeOutExpo');

    $('.tagline').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');
}

function gotoSplash()
{
    switch (activePage)
    {
        case 'history':
            $('#menuWork').attr('onclick', 'gotoWeb()');
            $('.mainBody').animate({
                transform: 'scale(0.75, 0.75) rotate(270deg)',
                marginTop: '-100',
                marginLeft: '0'
            }, 'easeOutExpo');

            $('.mainBody').animate({
                transform: 'scale(1, 1) rotate(315deg)'
            }, 1000, 'easeOutExpo');

            $('.tagline').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#contentWork').animate({
                opacity: 0
            }, 1000, 'easeOutExpo');

            $('#menu2').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#menu3').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('.contactNumbers').delay(400).animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#contentWork').delay(400).slideUp();
            break;

        case 'web':
            $('#menuWeb').attr('onclick', 'gotoWeb()');
            
            $('.mainBody').animate({
                transform: 'scale(0.75, 0.75) rotate(360deg)',
                marginTop: '-100',
                marginLeft: '0'
            }, 'easeOutExpo');

            $('.mainBody').animate({
                transform: 'scale(1, 1) rotate(315deg)'
            }, 'easeOutExpo');

            $('.tagline').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#contentWeb').animate({
                opacity: 0
            }, 1000, 'easeOutExpo');

            $('#menu2').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#menu3').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('.contactNumbers').delay(400).animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#contentWeb').delay(400).slideUp();
            break;
            
        case 'graphics':
            $('#menuGraphics').attr('onclick', 'gotoGraphics()');
            
            $('.mainBody').animate({
                transform: 'scale(0.75, 0.75) rotate(360deg)',
                marginTop: '-100',
                marginLeft: '0'
            }, 'easeOutExpo');

            $('.mainBody').animate({
                transform: 'scale(1, 1) rotate(315deg)'
            }, 'easeOutExpo');

            $('.tagline').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#contentGraphics').animate({
                opacity: 0
            }, 1000, 'easeOutExpo');

            $('#menu1').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#menu3').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('.contactNumbers').delay(400).animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#contentGraphics').delay(400).slideUp();
            break;
            
        case 'cg':
            $('#menuCg').attr('onclick', 'gotoCg()');
            
            $('.mainBody').animate({
                transform: 'scale(0.75, 0.75) rotate(360deg)',
                marginTop: '-100',
                marginLeft: '0'
            }, 'easeOutExpo');

            $('.mainBody').animate({
                transform: 'scale(1, 1) rotate(315deg)'
            }, 'easeOutExpo');

            $('.tagline').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#contentCg').animate({
                opacity: 0
            }, 1000, 'easeOutExpo');

            $('#menu1').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#menu2').animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('.contactNumbers').delay(400).animate({
                opacity: 1
            }, 1000, 'easeOutExpo');

            $('#contentCg').delay(400).slideUp();
            break;
    }

    activePage = 'splash';
}

function gotoWeb()
{
    activePage = 'web';
    $('#menuWeb').removeAttr('onclick');
    
    $('#contentWeb').delay().slideDown();

    $('.mainBody').animate({
        transform: 'scale(0.75, 0.75) rotate(360deg)'
    }, 'easeOut');

    $('.mainBody').animate({
        transform: 'scale(1.5, 1.5) rotate(360deg)',
        marginTop: '-390px',
        marginLeft: '530px'
    }, 1000, 'easeOutExpo');

    $('#contentWeb').animate({
        marginTop: '-200px',
        marginLeft: '10px',
        opacity: 1
    }, 1000, 'easeOutExpo');

    $('.tagline').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('.contactNumbers').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('#menu2').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('#menu3').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');
}

function gotoGraphics()
{
    activePage = 'graphics';
    $('#menuGraphics').removeAttr('onclick');
    
    $('#contentGraphics').delay().slideDown();

    $('.mainBody').animate({
        transform: 'scale(0.75, 0.75) rotate(360deg)'
    }, 'easeOut');

    $('.mainBody').animate({
        transform: 'scale(1.5, 1.5) rotate(360deg)',
        marginTop: '-460px',
        marginLeft: '395px'
    }, 1000, 'easeOutExpo');

    $('#contentGraphics').animate({
        marginTop: '-130px',
        marginLeft: '10px',
        opacity: 1
    }, 1000, 'easeOutExpo');

    $('.tagline').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('.contactNumbers').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('#menu1').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('#menu3').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');
}

function gotoCg()
{
    activePage = 'cg';
    $('#menuCg').removeAttr('onclick');
    
    $('#contentCg').delay().slideDown();

    $('.mainBody').animate({
        transform: 'scale(0.75, 0.75) rotate(360deg)'
    }, 'easeOut');

    $('.mainBody').animate({
        transform: 'scale(1.5, 1.5) rotate(360deg)',
        marginTop: '-530px',
        marginLeft: '570px'
    }, 1000, 'easeOutExpo');

    $('#contentCg').animate({
        marginTop: '-60px',
        marginLeft: '10px',
        opacity: 1
    }, 1000, 'easeOutExpo');

    $('.tagline').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('.contactNumbers').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('#menu1').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');

    $('#menu2').delay(400).animate({
        opacity: 0
    }, 1000, 'easeOutExpo');
}
