﻿var current_screen;
var screens;

$(document).ready(function () {
    screens = $("div.screen", "#basics_section");
    current_screen = $("#basics_soul");
    set_side_links();
});

function shift_screen(new_screen) {
    $("a.side_button", "#basics_section").fadeOut("fast");

    var function_name = String("exit_" + current_screen.attr("id"));
    window[function_name]();

    current_screen = new_screen;

    set_side_links();

    function_name = String("open_" + new_screen.attr("id"));
    window[function_name]();

    $("a.side_button", "#basics_section").fadeIn("fast");
}

function set_side_links(){

    var current = screens.index( current_screen );

    var previous_screen = screens.eq( current - 1 );
    var next_screen = current + 1;
    if (next_screen ==  (screens.length)){
        next_screen = 0;
    }
    next_screen = screens.eq( next_screen );

    $("a.side_button","#basics_section").unbind();
    $("a.previous", "#basics_section").click(function (e) { shift_screen(previous_screen); return false; }).attr("href", previous_screen.attr("name"));
    $("a.next", "#basics_section").click(function (e) { shift_screen(next_screen); return false; }).attr("href", next_screen.attr("name"));
}

//exit animation functions

function exit_basics_soul() {
    //alert("exit animation screen");
}

function exit_basics_services() {
    //alert("exit animation screen");
}

function exit_basics_clients() {
    //alert("exit animation screen");
}

function exit_basics_history() {
    //alert("exit animation screen");
}

function exit_basics_awards() {
    //alert("exit animation screen");
}

//open animation functions

function open_basics_soul() {
    //alert("open animation screen");
}

function open_basics_services() {
    //alert("open animation screen");
}

function open_basics_clients() {
    //alert("open animation screen");
}

function open_basics_history() {
    //alert("open animation screen");
}

function open_basics_awards() {
    //alert("open animation screen");
}
